<!DOCTYPE html>
<html lang="en-US">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="language" content="en" />
        <link href="./assets/ffd55088/css/bootstrap.css" rel="stylesheet">
<link href="./assets/5cf9384a/solarized_light.css" rel="stylesheet">
<link href="./assets/6c54116e/style.css" rel="stylesheet">
<script src="./assets/a44cef0f/jquery.js"></script>
<script src="./assets/ffd55088/js/bootstrap.js"></script>
<script src="./assets/8ac4e28a/jssearch.js"></script>    <title>ActiveRecord, yii\db\ActiveRecord - Yii Framework 2.0 API Documentation</title>
</head>
<body>

<div class="wrap">
    <nav id="w9415" class="navbar-inverse navbar-fixed-top navbar" role="navigation"><div class="navbar-header"><button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w9415-collapse"><span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span></button><a class="navbar-brand" href="./index.html">Yii Framework 2.0 API Documentation</a></div><div id="w9415-collapse" class="collapse navbar-collapse"><ul id="w9416" class="navbar-nav nav"><li><a href="./index.html">Class reference</a></li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Extensions <b class="caret"></b></a><ul id="w9417" class="dropdown-menu"><li><a href="./ext-apidoc-index.html" tabindex="-1">apidoc</a></li>
<li><a href="./ext-authclient-index.html" tabindex="-1">authclient</a></li>
<li><a href="./ext-bootstrap-index.html" tabindex="-1">bootstrap</a></li>
<li><a href="./ext-codeception-index.html" tabindex="-1">codeception</a></li>
<li><a href="./ext-debug-index.html" tabindex="-1">debug</a></li>
<li><a href="./ext-elasticsearch-index.html" tabindex="-1">elasticsearch</a></li>
<li><a href="./ext-faker-index.html" tabindex="-1">faker</a></li>
<li><a href="./ext-gii-index.html" tabindex="-1">gii</a></li>
<li><a href="./ext-imagine-index.html" tabindex="-1">imagine</a></li>
<li><a href="./ext-jui-index.html" tabindex="-1">jui</a></li>
<li><a href="./ext-mongodb-index.html" tabindex="-1">mongodb</a></li>
<li><a href="./ext-redis-index.html" tabindex="-1">redis</a></li>
<li><a href="./ext-smarty-index.html" tabindex="-1">smarty</a></li>
<li><a href="./ext-sphinx-index.html" tabindex="-1">sphinx</a></li>
<li><a href="./ext-swiftmailer-index.html" tabindex="-1">swiftmailer</a></li>
<li><a href="./ext-twig-index.html" tabindex="-1">twig</a></li></ul></li>
<li><a href="./guide-README.html">Guide</a></li></ul><div class="navbar-form navbar-left" role="search">
  <div class="form-group">
    <input id="searchbox" type="text" class="form-control" placeholder="Search">
  </div>
</div>
</div></nav>
    <div id="search-resultbox" style="display: none;" class="modal-content">
        <ul id="search-results">
        </ul>
    </div>

    
<div class="row">
    <div class="col-md-3">
                <div id="navigation" class="list-group"><a class="list-group-item" href="#navigation-9384" data-toggle="collapse" data-parent="#navigation">Not namespaced classes <b class="caret"></b></a><div id="navigation-9384" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii.html">Yii</a></div>
<a class="list-group-item" href="#navigation-9385" data-toggle="collapse" data-parent="#navigation">yii <b class="caret"></b></a><div id="navigation-9385" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-baseyii.html">BaseYii</a></div>
<a class="list-group-item" href="#navigation-9386" data-toggle="collapse" data-parent="#navigation">yii\base <b class="caret"></b></a><div id="navigation-9386" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-base-action.html">Action</a>
<a class="list-group-item" href="./yii-base-actionevent.html">ActionEvent</a>
<a class="list-group-item" href="./yii-base-actionfilter.html">ActionFilter</a>
<a class="list-group-item" href="./yii-base-application.html">Application</a>
<a class="list-group-item" href="./yii-base-arrayaccesstrait.html">ArrayAccessTrait</a>
<a class="list-group-item" href="./yii-base-arrayable.html">Arrayable</a>
<a class="list-group-item" href="./yii-base-arrayabletrait.html">ArrayableTrait</a>
<a class="list-group-item" href="./yii-base-behavior.html">Behavior</a>
<a class="list-group-item" href="./yii-base-bootstrapinterface.html">BootstrapInterface</a>
<a class="list-group-item" href="./yii-base-component.html">Component</a>
<a class="list-group-item" href="./yii-base-configurable.html">Configurable</a>
<a class="list-group-item" href="./yii-base-controller.html">Controller</a>
<a class="list-group-item" href="./yii-base-dynamicmodel.html">DynamicModel</a>
<a class="list-group-item" href="./yii-base-errorexception.html">ErrorException</a>
<a class="list-group-item" href="./yii-base-errorhandler.html">ErrorHandler</a>
<a class="list-group-item" href="./yii-base-event.html">Event</a>
<a class="list-group-item" href="./yii-base-exception.html">Exception</a>
<a class="list-group-item" href="./yii-base-exitexception.html">ExitException</a>
<a class="list-group-item" href="./yii-base-inlineaction.html">InlineAction</a>
<a class="list-group-item" href="./yii-base-invalidcallexception.html">InvalidCallException</a>
<a class="list-group-item" href="./yii-base-invalidconfigexception.html">InvalidConfigException</a>
<a class="list-group-item" href="./yii-base-invalidparamexception.html">InvalidParamException</a>
<a class="list-group-item" href="./yii-base-invalidrouteexception.html">InvalidRouteException</a>
<a class="list-group-item" href="./yii-base-invalidvalueexception.html">InvalidValueException</a>
<a class="list-group-item" href="./yii-base-model.html">Model</a>
<a class="list-group-item" href="./yii-base-modelevent.html">ModelEvent</a>
<a class="list-group-item" href="./yii-base-module.html">Module</a>
<a class="list-group-item" href="./yii-base-notsupportedexception.html">NotSupportedException</a>
<a class="list-group-item" href="./yii-base-object.html">Object</a>
<a class="list-group-item" href="./yii-base-request.html">Request</a>
<a class="list-group-item" href="./yii-base-response.html">Response</a>
<a class="list-group-item" href="./yii-base-security.html">Security</a>
<a class="list-group-item" href="./yii-base-theme.html">Theme</a>
<a class="list-group-item" href="./yii-base-unknownclassexception.html">UnknownClassException</a>
<a class="list-group-item" href="./yii-base-unknownmethodexception.html">UnknownMethodException</a>
<a class="list-group-item" href="./yii-base-unknownpropertyexception.html">UnknownPropertyException</a>
<a class="list-group-item" href="./yii-base-userexception.html">UserException</a>
<a class="list-group-item" href="./yii-base-view.html">View</a>
<a class="list-group-item" href="./yii-base-viewcontextinterface.html">ViewContextInterface</a>
<a class="list-group-item" href="./yii-base-viewevent.html">ViewEvent</a>
<a class="list-group-item" href="./yii-base-viewrenderer.html">ViewRenderer</a>
<a class="list-group-item" href="./yii-base-widget.html">Widget</a></div>
<a class="list-group-item" href="#navigation-9387" data-toggle="collapse" data-parent="#navigation">yii\behaviors <b class="caret"></b></a><div id="navigation-9387" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-behaviors-attributebehavior.html">AttributeBehavior</a>
<a class="list-group-item" href="./yii-behaviors-blameablebehavior.html">BlameableBehavior</a>
<a class="list-group-item" href="./yii-behaviors-sluggablebehavior.html">SluggableBehavior</a>
<a class="list-group-item" href="./yii-behaviors-timestampbehavior.html">TimestampBehavior</a></div>
<a class="list-group-item" href="#navigation-9388" data-toggle="collapse" data-parent="#navigation">yii\caching <b class="caret"></b></a><div id="navigation-9388" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-caching-apccache.html">ApcCache</a>
<a class="list-group-item" href="./yii-caching-arraycache.html">ArrayCache</a>
<a class="list-group-item" href="./yii-caching-cache.html">Cache</a>
<a class="list-group-item" href="./yii-caching-chaineddependency.html">ChainedDependency</a>
<a class="list-group-item" href="./yii-caching-dbcache.html">DbCache</a>
<a class="list-group-item" href="./yii-caching-dbdependency.html">DbDependency</a>
<a class="list-group-item" href="./yii-caching-dependency.html">Dependency</a>
<a class="list-group-item" href="./yii-caching-dummycache.html">DummyCache</a>
<a class="list-group-item" href="./yii-caching-expressiondependency.html">ExpressionDependency</a>
<a class="list-group-item" href="./yii-caching-filecache.html">FileCache</a>
<a class="list-group-item" href="./yii-caching-filedependency.html">FileDependency</a>
<a class="list-group-item" href="./yii-caching-memcache.html">MemCache</a>
<a class="list-group-item" href="./yii-caching-memcacheserver.html">MemCacheServer</a>
<a class="list-group-item" href="./yii-caching-tagdependency.html">TagDependency</a>
<a class="list-group-item" href="./yii-caching-wincache.html">WinCache</a>
<a class="list-group-item" href="./yii-caching-xcache.html">XCache</a>
<a class="list-group-item" href="./yii-caching-zenddatacache.html">ZendDataCache</a></div>
<a class="list-group-item" href="#navigation-9389" data-toggle="collapse" data-parent="#navigation">yii\captcha <b class="caret"></b></a><div id="navigation-9389" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-captcha-captcha.html">Captcha</a>
<a class="list-group-item" href="./yii-captcha-captchaaction.html">CaptchaAction</a>
<a class="list-group-item" href="./yii-captcha-captchaasset.html">CaptchaAsset</a>
<a class="list-group-item" href="./yii-captcha-captchavalidator.html">CaptchaValidator</a></div>
<a class="list-group-item" href="#navigation-9390" data-toggle="collapse" data-parent="#navigation">yii\console <b class="caret"></b></a><div id="navigation-9390" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-console-application.html">Application</a>
<a class="list-group-item" href="./yii-console-controller.html">Controller</a>
<a class="list-group-item" href="./yii-console-errorhandler.html">ErrorHandler</a>
<a class="list-group-item" href="./yii-console-exception.html">Exception</a>
<a class="list-group-item" href="./yii-console-markdown.html">Markdown</a>
<a class="list-group-item" href="./yii-console-request.html">Request</a>
<a class="list-group-item" href="./yii-console-response.html">Response</a></div>
<a class="list-group-item" href="#navigation-9391" data-toggle="collapse" data-parent="#navigation">yii\console\controllers <b class="caret"></b></a><div id="navigation-9391" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-console-controllers-assetcontroller.html">AssetController</a>
<a class="list-group-item" href="./yii-console-controllers-basemigratecontroller.html">BaseMigrateController</a>
<a class="list-group-item" href="./yii-console-controllers-cachecontroller.html">CacheController</a>
<a class="list-group-item" href="./yii-console-controllers-fixturecontroller.html">FixtureController</a>
<a class="list-group-item" href="./yii-console-controllers-helpcontroller.html">HelpController</a>
<a class="list-group-item" href="./yii-console-controllers-messagecontroller.html">MessageController</a>
<a class="list-group-item" href="./yii-console-controllers-migratecontroller.html">MigrateController</a>
<a class="list-group-item" href="./yii-console-controllers-servecontroller.html">ServeController</a></div>
<a class="list-group-item" href="#navigation-9392" data-toggle="collapse" data-parent="#navigation">yii\data <b class="caret"></b></a><div id="navigation-9392" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-data-activedataprovider.html">ActiveDataProvider</a>
<a class="list-group-item" href="./yii-data-arraydataprovider.html">ArrayDataProvider</a>
<a class="list-group-item" href="./yii-data-basedataprovider.html">BaseDataProvider</a>
<a class="list-group-item" href="./yii-data-dataproviderinterface.html">DataProviderInterface</a>
<a class="list-group-item" href="./yii-data-pagination.html">Pagination</a>
<a class="list-group-item" href="./yii-data-sort.html">Sort</a>
<a class="list-group-item" href="./yii-data-sqldataprovider.html">SqlDataProvider</a></div>
<a class="list-group-item active" href="#navigation-9393" data-toggle="collapse" data-parent="#navigation">yii\db <b class="caret"></b></a><div id="navigation-9393" class="submenu panel-collapse collapse in"><a class="list-group-item" href="./yii-db-activequery.html">ActiveQuery</a>
<a class="list-group-item" href="./yii-db-activequeryinterface.html">ActiveQueryInterface</a>
<a class="list-group-item" href="./yii-db-activequerytrait.html">ActiveQueryTrait</a>
<a class="list-group-item active" href="./yii-db-activerecord.html">ActiveRecord</a>
<a class="list-group-item" href="./yii-db-activerecordinterface.html">ActiveRecordInterface</a>
<a class="list-group-item" href="./yii-db-activerelationtrait.html">ActiveRelationTrait</a>
<a class="list-group-item" href="./yii-db-aftersaveevent.html">AfterSaveEvent</a>
<a class="list-group-item" href="./yii-db-baseactiverecord.html">BaseActiveRecord</a>
<a class="list-group-item" href="./yii-db-batchqueryresult.html">BatchQueryResult</a>
<a class="list-group-item" href="./yii-db-columnschema.html">ColumnSchema</a>
<a class="list-group-item" href="./yii-db-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-command.html">Command</a>
<a class="list-group-item" href="./yii-db-connection.html">Connection</a>
<a class="list-group-item" href="./yii-db-datareader.html">DataReader</a>
<a class="list-group-item" href="./yii-db-exception.html">Exception</a>
<a class="list-group-item" href="./yii-db-expression.html">Expression</a>
<a class="list-group-item" href="./yii-db-integrityexception.html">IntegrityException</a>
<a class="list-group-item" href="./yii-db-migration.html">Migration</a>
<a class="list-group-item" href="./yii-db-migrationinterface.html">MigrationInterface</a>
<a class="list-group-item" href="./yii-db-query.html">Query</a>
<a class="list-group-item" href="./yii-db-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-queryinterface.html">QueryInterface</a>
<a class="list-group-item" href="./yii-db-querytrait.html">QueryTrait</a>
<a class="list-group-item" href="./yii-db-schema.html">Schema</a>
<a class="list-group-item" href="./yii-db-schemabuildertrait.html">SchemaBuilderTrait</a>
<a class="list-group-item" href="./yii-db-staleobjectexception.html">StaleObjectException</a>
<a class="list-group-item" href="./yii-db-tableschema.html">TableSchema</a>
<a class="list-group-item" href="./yii-db-transaction.html">Transaction</a></div>
<a class="list-group-item" href="#navigation-9394" data-toggle="collapse" data-parent="#navigation">yii\db\cubrid <b class="caret"></b></a><div id="navigation-9394" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-cubrid-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-cubrid-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-cubrid-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9395" data-toggle="collapse" data-parent="#navigation">yii\db\mssql <b class="caret"></b></a><div id="navigation-9395" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-mssql-pdo.html">PDO</a>
<a class="list-group-item" href="./yii-db-mssql-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-mssql-schema.html">Schema</a>
<a class="list-group-item" href="./yii-db-mssql-sqlsrvpdo.html">SqlsrvPDO</a>
<a class="list-group-item" href="./yii-db-mssql-tableschema.html">TableSchema</a></div>
<a class="list-group-item" href="#navigation-9396" data-toggle="collapse" data-parent="#navigation">yii\db\mysql <b class="caret"></b></a><div id="navigation-9396" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-mysql-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-mysql-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-mysql-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9397" data-toggle="collapse" data-parent="#navigation">yii\db\oci <b class="caret"></b></a><div id="navigation-9397" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-oci-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-oci-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-oci-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9398" data-toggle="collapse" data-parent="#navigation">yii\db\pgsql <b class="caret"></b></a><div id="navigation-9398" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-pgsql-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-pgsql-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9399" data-toggle="collapse" data-parent="#navigation">yii\db\sqlite <b class="caret"></b></a><div id="navigation-9399" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-sqlite-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-sqlite-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-sqlite-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9400" data-toggle="collapse" data-parent="#navigation">yii\di <b class="caret"></b></a><div id="navigation-9400" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-di-container.html">Container</a>
<a class="list-group-item" href="./yii-di-instance.html">Instance</a>
<a class="list-group-item" href="./yii-di-notinstantiableexception.html">NotInstantiableException</a>
<a class="list-group-item" href="./yii-di-servicelocator.html">ServiceLocator</a></div>
<a class="list-group-item" href="#navigation-9401" data-toggle="collapse" data-parent="#navigation">yii\filters <b class="caret"></b></a><div id="navigation-9401" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-filters-accesscontrol.html">AccessControl</a>
<a class="list-group-item" href="./yii-filters-accessrule.html">AccessRule</a>
<a class="list-group-item" href="./yii-filters-contentnegotiator.html">ContentNegotiator</a>
<a class="list-group-item" href="./yii-filters-cors.html">Cors</a>
<a class="list-group-item" href="./yii-filters-httpcache.html">HttpCache</a>
<a class="list-group-item" href="./yii-filters-pagecache.html">PageCache</a>
<a class="list-group-item" href="./yii-filters-ratelimitinterface.html">RateLimitInterface</a>
<a class="list-group-item" href="./yii-filters-ratelimiter.html">RateLimiter</a>
<a class="list-group-item" href="./yii-filters-verbfilter.html">VerbFilter</a></div>
<a class="list-group-item" href="#navigation-9402" data-toggle="collapse" data-parent="#navigation">yii\filters\auth <b class="caret"></b></a><div id="navigation-9402" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-filters-auth-authinterface.html">AuthInterface</a>
<a class="list-group-item" href="./yii-filters-auth-authmethod.html">AuthMethod</a>
<a class="list-group-item" href="./yii-filters-auth-compositeauth.html">CompositeAuth</a>
<a class="list-group-item" href="./yii-filters-auth-httpbasicauth.html">HttpBasicAuth</a>
<a class="list-group-item" href="./yii-filters-auth-httpbearerauth.html">HttpBearerAuth</a>
<a class="list-group-item" href="./yii-filters-auth-queryparamauth.html">QueryParamAuth</a></div>
<a class="list-group-item" href="#navigation-9403" data-toggle="collapse" data-parent="#navigation">yii\grid <b class="caret"></b></a><div id="navigation-9403" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-grid-actioncolumn.html">ActionColumn</a>
<a class="list-group-item" href="./yii-grid-checkboxcolumn.html">CheckboxColumn</a>
<a class="list-group-item" href="./yii-grid-column.html">Column</a>
<a class="list-group-item" href="./yii-grid-datacolumn.html">DataColumn</a>
<a class="list-group-item" href="./yii-grid-gridview.html">GridView</a>
<a class="list-group-item" href="./yii-grid-gridviewasset.html">GridViewAsset</a>
<a class="list-group-item" href="./yii-grid-serialcolumn.html">SerialColumn</a></div>
<a class="list-group-item" href="#navigation-9404" data-toggle="collapse" data-parent="#navigation">yii\helpers <b class="caret"></b></a><div id="navigation-9404" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-helpers-arrayhelper.html">ArrayHelper</a>
<a class="list-group-item" href="./yii-helpers-basearrayhelper.html">BaseArrayHelper</a>
<a class="list-group-item" href="./yii-helpers-baseconsole.html">BaseConsole</a>
<a class="list-group-item" href="./yii-helpers-basefilehelper.html">BaseFileHelper</a>
<a class="list-group-item" href="./yii-helpers-baseformatconverter.html">BaseFormatConverter</a>
<a class="list-group-item" href="./yii-helpers-basehtml.html">BaseHtml</a>
<a class="list-group-item" href="./yii-helpers-basehtmlpurifier.html">BaseHtmlPurifier</a>
<a class="list-group-item" href="./yii-helpers-baseinflector.html">BaseInflector</a>
<a class="list-group-item" href="./yii-helpers-basejson.html">BaseJson</a>
<a class="list-group-item" href="./yii-helpers-basemarkdown.html">BaseMarkdown</a>
<a class="list-group-item" href="./yii-helpers-basestringhelper.html">BaseStringHelper</a>
<a class="list-group-item" href="./yii-helpers-baseurl.html">BaseUrl</a>
<a class="list-group-item" href="./yii-helpers-basevardumper.html">BaseVarDumper</a>
<a class="list-group-item" href="./yii-helpers-console.html">Console</a>
<a class="list-group-item" href="./yii-helpers-filehelper.html">FileHelper</a>
<a class="list-group-item" href="./yii-helpers-formatconverter.html">FormatConverter</a>
<a class="list-group-item" href="./yii-helpers-html.html">Html</a>
<a class="list-group-item" href="./yii-helpers-htmlpurifier.html">HtmlPurifier</a>
<a class="list-group-item" href="./yii-helpers-inflector.html">Inflector</a>
<a class="list-group-item" href="./yii-helpers-json.html">Json</a>
<a class="list-group-item" href="./yii-helpers-markdown.html">Markdown</a>
<a class="list-group-item" href="./yii-helpers-stringhelper.html">StringHelper</a>
<a class="list-group-item" href="./yii-helpers-url.html">Url</a>
<a class="list-group-item" href="./yii-helpers-vardumper.html">VarDumper</a></div>
<a class="list-group-item" href="#navigation-9405" data-toggle="collapse" data-parent="#navigation">yii\i18n <b class="caret"></b></a><div id="navigation-9405" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-i18n-dbmessagesource.html">DbMessageSource</a>
<a class="list-group-item" href="./yii-i18n-formatter.html">Formatter</a>
<a class="list-group-item" href="./yii-i18n-gettextfile.html">GettextFile</a>
<a class="list-group-item" href="./yii-i18n-gettextmessagesource.html">GettextMessageSource</a>
<a class="list-group-item" href="./yii-i18n-gettextmofile.html">GettextMoFile</a>
<a class="list-group-item" href="./yii-i18n-gettextpofile.html">GettextPoFile</a>
<a class="list-group-item" href="./yii-i18n-i18n.html">I18N</a>
<a class="list-group-item" href="./yii-i18n-messageformatter.html">MessageFormatter</a>
<a class="list-group-item" href="./yii-i18n-messagesource.html">MessageSource</a>
<a class="list-group-item" href="./yii-i18n-missingtranslationevent.html">MissingTranslationEvent</a>
<a class="list-group-item" href="./yii-i18n-phpmessagesource.html">PhpMessageSource</a></div>
<a class="list-group-item" href="#navigation-9406" data-toggle="collapse" data-parent="#navigation">yii\log <b class="caret"></b></a><div id="navigation-9406" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-log-dbtarget.html">DbTarget</a>
<a class="list-group-item" href="./yii-log-dispatcher.html">Dispatcher</a>
<a class="list-group-item" href="./yii-log-emailtarget.html">EmailTarget</a>
<a class="list-group-item" href="./yii-log-filetarget.html">FileTarget</a>
<a class="list-group-item" href="./yii-log-logger.html">Logger</a>
<a class="list-group-item" href="./yii-log-syslogtarget.html">SyslogTarget</a>
<a class="list-group-item" href="./yii-log-target.html">Target</a></div>
<a class="list-group-item" href="#navigation-9407" data-toggle="collapse" data-parent="#navigation">yii\mail <b class="caret"></b></a><div id="navigation-9407" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-mail-basemailer.html">BaseMailer</a>
<a class="list-group-item" href="./yii-mail-basemessage.html">BaseMessage</a>
<a class="list-group-item" href="./yii-mail-mailevent.html">MailEvent</a>
<a class="list-group-item" href="./yii-mail-mailerinterface.html">MailerInterface</a>
<a class="list-group-item" href="./yii-mail-messageinterface.html">MessageInterface</a></div>
<a class="list-group-item" href="#navigation-9408" data-toggle="collapse" data-parent="#navigation">yii\mutex <b class="caret"></b></a><div id="navigation-9408" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-mutex-dbmutex.html">DbMutex</a>
<a class="list-group-item" href="./yii-mutex-filemutex.html">FileMutex</a>
<a class="list-group-item" href="./yii-mutex-mutex.html">Mutex</a>
<a class="list-group-item" href="./yii-mutex-mysqlmutex.html">MysqlMutex</a>
<a class="list-group-item" href="./yii-mutex-pgsqlmutex.html">PgsqlMutex</a></div>
<a class="list-group-item" href="#navigation-9409" data-toggle="collapse" data-parent="#navigation">yii\rbac <b class="caret"></b></a><div id="navigation-9409" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-rbac-assignment.html">Assignment</a>
<a class="list-group-item" href="./yii-rbac-basemanager.html">BaseManager</a>
<a class="list-group-item" href="./yii-rbac-checkaccessinterface.html">CheckAccessInterface</a>
<a class="list-group-item" href="./yii-rbac-dbmanager.html">DbManager</a>
<a class="list-group-item" href="./yii-rbac-item.html">Item</a>
<a class="list-group-item" href="./yii-rbac-managerinterface.html">ManagerInterface</a>
<a class="list-group-item" href="./yii-rbac-permission.html">Permission</a>
<a class="list-group-item" href="./yii-rbac-phpmanager.html">PhpManager</a>
<a class="list-group-item" href="./yii-rbac-role.html">Role</a>
<a class="list-group-item" href="./yii-rbac-rule.html">Rule</a></div>
<a class="list-group-item" href="#navigation-9410" data-toggle="collapse" data-parent="#navigation">yii\rest <b class="caret"></b></a><div id="navigation-9410" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-rest-action.html">Action</a>
<a class="list-group-item" href="./yii-rest-activecontroller.html">ActiveController</a>
<a class="list-group-item" href="./yii-rest-controller.html">Controller</a>
<a class="list-group-item" href="./yii-rest-createaction.html">CreateAction</a>
<a class="list-group-item" href="./yii-rest-deleteaction.html">DeleteAction</a>
<a class="list-group-item" href="./yii-rest-indexaction.html">IndexAction</a>
<a class="list-group-item" href="./yii-rest-optionsaction.html">OptionsAction</a>
<a class="list-group-item" href="./yii-rest-serializer.html">Serializer</a>
<a class="list-group-item" href="./yii-rest-updateaction.html">UpdateAction</a>
<a class="list-group-item" href="./yii-rest-urlrule.html">UrlRule</a>
<a class="list-group-item" href="./yii-rest-viewaction.html">ViewAction</a></div>
<a class="list-group-item" href="#navigation-9411" data-toggle="collapse" data-parent="#navigation">yii\test <b class="caret"></b></a><div id="navigation-9411" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-test-activefixture.html">ActiveFixture</a>
<a class="list-group-item" href="./yii-test-arrayfixture.html">ArrayFixture</a>
<a class="list-group-item" href="./yii-test-baseactivefixture.html">BaseActiveFixture</a>
<a class="list-group-item" href="./yii-test-dbfixture.html">DbFixture</a>
<a class="list-group-item" href="./yii-test-fixture.html">Fixture</a>
<a class="list-group-item" href="./yii-test-fixturetrait.html">FixtureTrait</a>
<a class="list-group-item" href="./yii-test-initdbfixture.html">InitDbFixture</a></div>
<a class="list-group-item" href="#navigation-9412" data-toggle="collapse" data-parent="#navigation">yii\validators <b class="caret"></b></a><div id="navigation-9412" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-validators-booleanvalidator.html">BooleanValidator</a>
<a class="list-group-item" href="./yii-validators-comparevalidator.html">CompareValidator</a>
<a class="list-group-item" href="./yii-validators-datevalidator.html">DateValidator</a>
<a class="list-group-item" href="./yii-validators-defaultvaluevalidator.html">DefaultValueValidator</a>
<a class="list-group-item" href="./yii-validators-eachvalidator.html">EachValidator</a>
<a class="list-group-item" href="./yii-validators-emailvalidator.html">EmailValidator</a>
<a class="list-group-item" href="./yii-validators-existvalidator.html">ExistValidator</a>
<a class="list-group-item" href="./yii-validators-filevalidator.html">FileValidator</a>
<a class="list-group-item" href="./yii-validators-filtervalidator.html">FilterValidator</a>
<a class="list-group-item" href="./yii-validators-imagevalidator.html">ImageValidator</a>
<a class="list-group-item" href="./yii-validators-inlinevalidator.html">InlineValidator</a>
<a class="list-group-item" href="./yii-validators-ipvalidator.html">IpValidator</a>
<a class="list-group-item" href="./yii-validators-numbervalidator.html">NumberValidator</a>
<a class="list-group-item" href="./yii-validators-punycodeasset.html">PunycodeAsset</a>
<a class="list-group-item" href="./yii-validators-rangevalidator.html">RangeValidator</a>
<a class="list-group-item" href="./yii-validators-regularexpressionvalidator.html">RegularExpressionValidator</a>
<a class="list-group-item" href="./yii-validators-requiredvalidator.html">RequiredValidator</a>
<a class="list-group-item" href="./yii-validators-safevalidator.html">SafeValidator</a>
<a class="list-group-item" href="./yii-validators-stringvalidator.html">StringValidator</a>
<a class="list-group-item" href="./yii-validators-uniquevalidator.html">UniqueValidator</a>
<a class="list-group-item" href="./yii-validators-urlvalidator.html">UrlValidator</a>
<a class="list-group-item" href="./yii-validators-validationasset.html">ValidationAsset</a>
<a class="list-group-item" href="./yii-validators-validator.html">Validator</a></div>
<a class="list-group-item" href="#navigation-9413" data-toggle="collapse" data-parent="#navigation">yii\web <b class="caret"></b></a><div id="navigation-9413" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-web-application.html">Application</a>
<a class="list-group-item" href="./yii-web-assetbundle.html">AssetBundle</a>
<a class="list-group-item" href="./yii-web-assetconverter.html">AssetConverter</a>
<a class="list-group-item" href="./yii-web-assetconverterinterface.html">AssetConverterInterface</a>
<a class="list-group-item" href="./yii-web-assetmanager.html">AssetManager</a>
<a class="list-group-item" href="./yii-web-badrequesthttpexception.html">BadRequestHttpException</a>
<a class="list-group-item" href="./yii-web-cachesession.html">CacheSession</a>
<a class="list-group-item" href="./yii-web-compositeurlrule.html">CompositeUrlRule</a>
<a class="list-group-item" href="./yii-web-conflicthttpexception.html">ConflictHttpException</a>
<a class="list-group-item" href="./yii-web-controller.html">Controller</a>
<a class="list-group-item" href="./yii-web-cookie.html">Cookie</a>
<a class="list-group-item" href="./yii-web-cookiecollection.html">CookieCollection</a>
<a class="list-group-item" href="./yii-web-dbsession.html">DbSession</a>
<a class="list-group-item" href="./yii-web-erroraction.html">ErrorAction</a>
<a class="list-group-item" href="./yii-web-errorhandler.html">ErrorHandler</a>
<a class="list-group-item" href="./yii-web-forbiddenhttpexception.html">ForbiddenHttpException</a>
<a class="list-group-item" href="./yii-web-gonehttpexception.html">GoneHttpException</a>
<a class="list-group-item" href="./yii-web-groupurlrule.html">GroupUrlRule</a>
<a class="list-group-item" href="./yii-web-headercollection.html">HeaderCollection</a>
<a class="list-group-item" href="./yii-web-htmlresponseformatter.html">HtmlResponseFormatter</a>
<a class="list-group-item" href="./yii-web-httpexception.html">HttpException</a>
<a class="list-group-item" href="./yii-web-identityinterface.html">IdentityInterface</a>
<a class="list-group-item" href="./yii-web-jqueryasset.html">JqueryAsset</a>
<a class="list-group-item" href="./yii-web-jsexpression.html">JsExpression</a>
<a class="list-group-item" href="./yii-web-jsonparser.html">JsonParser</a>
<a class="list-group-item" href="./yii-web-jsonresponseformatter.html">JsonResponseFormatter</a>
<a class="list-group-item" href="./yii-web-link.html">Link</a>
<a class="list-group-item" href="./yii-web-linkable.html">Linkable</a>
<a class="list-group-item" href="./yii-web-methodnotallowedhttpexception.html">MethodNotAllowedHttpException</a>
<a class="list-group-item" href="./yii-web-multifieldsession.html">MultiFieldSession</a>
<a class="list-group-item" href="./yii-web-notacceptablehttpexception.html">NotAcceptableHttpException</a>
<a class="list-group-item" href="./yii-web-notfoundhttpexception.html">NotFoundHttpException</a>
<a class="list-group-item" href="./yii-web-request.html">Request</a>
<a class="list-group-item" href="./yii-web-requestparserinterface.html">RequestParserInterface</a>
<a class="list-group-item" href="./yii-web-response.html">Response</a>
<a class="list-group-item" href="./yii-web-responseformatterinterface.html">ResponseFormatterInterface</a>
<a class="list-group-item" href="./yii-web-servererrorhttpexception.html">ServerErrorHttpException</a>
<a class="list-group-item" href="./yii-web-session.html">Session</a>
<a class="list-group-item" href="./yii-web-sessioniterator.html">SessionIterator</a>
<a class="list-group-item" href="./yii-web-toomanyrequestshttpexception.html">TooManyRequestsHttpException</a>
<a class="list-group-item" href="./yii-web-unauthorizedhttpexception.html">UnauthorizedHttpException</a>
<a class="list-group-item" href="./yii-web-unprocessableentityhttpexception.html">UnprocessableEntityHttpException</a>
<a class="list-group-item" href="./yii-web-unsupportedmediatypehttpexception.html">UnsupportedMediaTypeHttpException</a>
<a class="list-group-item" href="./yii-web-uploadedfile.html">UploadedFile</a>
<a class="list-group-item" href="./yii-web-urlmanager.html">UrlManager</a>
<a class="list-group-item" href="./yii-web-urlrule.html">UrlRule</a>
<a class="list-group-item" href="./yii-web-urlruleinterface.html">UrlRuleInterface</a>
<a class="list-group-item" href="./yii-web-user.html">User</a>
<a class="list-group-item" href="./yii-web-userevent.html">UserEvent</a>
<a class="list-group-item" href="./yii-web-view.html">View</a>
<a class="list-group-item" href="./yii-web-viewaction.html">ViewAction</a>
<a class="list-group-item" href="./yii-web-xmlresponseformatter.html">XmlResponseFormatter</a>
<a class="list-group-item" href="./yii-web-yiiasset.html">YiiAsset</a></div>
<a class="list-group-item" href="#navigation-9414" data-toggle="collapse" data-parent="#navigation">yii\widgets <b class="caret"></b></a><div id="navigation-9414" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-widgets-activefield.html">ActiveField</a>
<a class="list-group-item" href="./yii-widgets-activeform.html">ActiveForm</a>
<a class="list-group-item" href="./yii-widgets-activeformasset.html">ActiveFormAsset</a>
<a class="list-group-item" href="./yii-widgets-baselistview.html">BaseListView</a>
<a class="list-group-item" href="./yii-widgets-block.html">Block</a>
<a class="list-group-item" href="./yii-widgets-breadcrumbs.html">Breadcrumbs</a>
<a class="list-group-item" href="./yii-widgets-contentdecorator.html">ContentDecorator</a>
<a class="list-group-item" href="./yii-widgets-detailview.html">DetailView</a>
<a class="list-group-item" href="./yii-widgets-fragmentcache.html">FragmentCache</a>
<a class="list-group-item" href="./yii-widgets-inputwidget.html">InputWidget</a>
<a class="list-group-item" href="./yii-widgets-linkpager.html">LinkPager</a>
<a class="list-group-item" href="./yii-widgets-linksorter.html">LinkSorter</a>
<a class="list-group-item" href="./yii-widgets-listview.html">ListView</a>
<a class="list-group-item" href="./yii-widgets-maskedinput.html">MaskedInput</a>
<a class="list-group-item" href="./yii-widgets-maskedinputasset.html">MaskedInputAsset</a>
<a class="list-group-item" href="./yii-widgets-menu.html">Menu</a>
<a class="list-group-item" href="./yii-widgets-pjax.html">Pjax</a>
<a class="list-group-item" href="./yii-widgets-pjaxasset.html">PjaxAsset</a>
<a class="list-group-item" href="./yii-widgets-spaceless.html">Spaceless</a></div></div>    </div>
    <div class="col-md-9 api-content" role="main">
        <h1>Class yii\db\ActiveRecord</h1>
<div class="top-nav">
    <a href="index.html">All Classes</a>
            | <a href="#properties">Properties</a>
                | <a href="#methods">Methods</a>
                | <a href="#events">Events</a>
                | <a href="#constants">Constants</a>
    </div>

<table class="summaryTable docClass table table-bordered">
    <colgroup>
        <col class="col-name" />
        <col class="col-value" />
    </colgroup>
            <tr><th>Inheritance</th><td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a> &raquo;
<a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a> &raquo;
<a href="yii-base-model.html">yii\base\Model</a> &raquo;
<a href="yii-base-component.html">yii\base\Component</a> &raquo;
<a href="yii-base-object.html">yii\base\Object</a></td></tr>
                <tr><th>Implements</th><td><a href="http://www.php.net/class.arrayaccess">ArrayAccess</a>, <a href="http://www.php.net/class.iteratoraggregate">IteratorAggregate</a>, <a href="yii-base-arrayable.html">yii\base\Arrayable</a>, <a href="yii-base-configurable.html">yii\base\Configurable</a>, <a href="yii-db-activerecordinterface.html">yii\db\ActiveRecordInterface</a></td></tr>
                    <tr><th>Uses Traits</th><td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td></tr>
                            <tr><th>Available since version</th><td>2.0</td></tr>
                    <tr>
          <th>Source Code</th>
          <td><a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php">https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php</a></td>
        </tr>
    </table>

<div class="class-description">
    <p><strong>ActiveRecord is the base class for classes representing relational data in terms of objects.</strong></p>
    <p>Active Record implements the <a href="http://en.wikipedia.org/wiki/Active_record">Active Record design pattern</a>.
The premise behind Active Record is that an individual <a href="yii-db-activerecord.html">yii\db\ActiveRecord</a> object is associated with a specific
row in a database table. The object's attributes are mapped to the columns of the corresponding table.
Referencing an Active Record attribute is equivalent to accessing the corresponding table column for that record.</p>
<p>As an example, say that the <code>Customer</code> ActiveRecord class is associated with the <code>customer</code> table.
This would mean that the class's <code>name</code> attribute is automatically mapped to the <code>name</code> column in <code>customer</code> table.
Thanks to Active Record, assuming the variable <code>$customer</code> is an object of type <code>Customer</code>, to get the value of
the <code>name</code> column for the table row, you can use the expression <code>$customer-&gt;name</code>.
In this example, Active Record is providing an object-oriented interface for accessing data stored in the database.
But Active Record provides much more functionality than this.</p>
<p>To declare an ActiveRecord class you need to extend <a href="yii-db-activerecord.html">yii\db\ActiveRecord</a> and
implement the <code>tableName</code> method:</p>
<pre><code class="hljs php language-php"><span class="hljs-preprocessor">&lt;?php</span>

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Customer</span> <span class="hljs-keyword">extends</span> \<span class="hljs-title">yii</span>\<span class="hljs-title">db</span>\<span class="hljs-title">ActiveRecord</span>
</span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">tableName</span><span class="hljs-params">()</span>
    </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-string">'customer'</span>;
    }
}
</code></pre>
<p>The <code>tableName</code> method only has to return the name of the database table associated with the class.</p>
<blockquote class="tip"><p><strong>Tip: </strong>You may also use the <a href="./guide-start-gii.html">Gii code generator</a> to generate ActiveRecord classes from your
database tables.</p>
</blockquote>
<p>Class instances are obtained in one of two ways:</p>
<ul>
<li>Using the <code>new</code> operator to create a new, empty object</li>
<li>Using a method to fetch an existing record (or records) from the database</li>
</ul>
<p>Below is an example showing some typical usage of ActiveRecord:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$user</span> = <span class="hljs-keyword">new</span> User();
<span class="hljs-variable">$user</span>-&gt;name = <span class="hljs-string">'Qiang'</span>;
<span class="hljs-variable">$user</span>-&gt;save();  <span class="hljs-comment">// a new row is inserted into user table</span>

<span class="hljs-comment">// the following will retrieve the user 'CeBe' from the database</span>
<span class="hljs-variable">$user</span> = User::find()-&gt;where([<span class="hljs-string">'name'</span> =&gt; <span class="hljs-string">'CeBe'</span>])-&gt;one();

<span class="hljs-comment">// this will get related records from orders table when relation is defined</span>
<span class="hljs-variable">$orders</span> = <span class="hljs-variable">$user</span>-&gt;orders;
</code></pre>
<p>For more details and usage information on ActiveRecord, see the <a href="./guide-db-active-record.html">guide article on ActiveRecord</a>.</p>

    </div>

<a id="properties"></a>

<div class="summary doc-property">
<h2>Public Properties</h2>

<p><a href="#" class="toggle">Hide inherited properties</a></p>

<table class="summary-table table table-striped table-bordered table-hover">
<colgroup>
    <col class="col-property" />
    <col class="col-type" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>
<tr>
  <th>Property</th><th>Type</th><th>Description</th><th>Defined By</th>
</tr>
        <tr class="inherited" id="$activeValidators">
        <td><a href="yii-base-model.html#$activeValidators-detail">$activeValidators</a></td>
        <td><a href="yii-validators-validator.html">yii\validators\Validator</a>[]</td>
        <td>The validators applicable to the current <a href="yii-base-model.html#$scenario-detail">$scenario</a>.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$attributes">
        <td><a href="yii-base-model.html#$attributes-detail">$attributes</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>Attribute values (name =&gt; value).</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$behaviors">
        <td><a href="yii-base-component.html#$behaviors-detail">$behaviors</a></td>
        <td><a href="yii-base-behavior.html">yii\base\Behavior</a>[]</td>
        <td>List of behaviors attached to this component</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="$dirtyAttributes">
        <td><a href="yii-db-baseactiverecord.html#$dirtyAttributes-detail">$dirtyAttributes</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>The changed attribute values (name-value pairs)</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$errors">
        <td><a href="yii-base-model.html#$errors-detail">$errors</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>Errors for all attributes or the specified attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$firstErrors">
        <td><a href="yii-base-model.html#$firstErrors-detail">$firstErrors</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>The first errors.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$isNewRecord">
        <td><a href="yii-db-baseactiverecord.html#$isNewRecord-detail">$isNewRecord</a></td>
        <td><a href="http://www.php.net/language.types.boolean">boolean</a></td>
        <td>Whether the record is new and should be inserted when calling <a href="yii-db-baseactiverecord.html#save()-detail">save()</a>.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$iterator">
        <td><a href="yii-base-model.html#$iterator-detail">$iterator</a></td>
        <td><a href="http://www.php.net/class.arrayiterator">ArrayIterator</a></td>
        <td>An iterator for traversing the items in the list.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$oldAttributes">
        <td><a href="yii-db-baseactiverecord.html#$oldAttributes-detail">$oldAttributes</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>The old attribute values (name-value pairs)</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$oldPrimaryKey">
        <td><a href="yii-db-baseactiverecord.html#$oldPrimaryKey-detail">$oldPrimaryKey</a></td>
        <td>mixed</td>
        <td>The old primary key value.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$primaryKey">
        <td><a href="yii-db-baseactiverecord.html#$primaryKey-detail">$primaryKey</a></td>
        <td>mixed</td>
        <td>The primary key value.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$relatedRecords">
        <td><a href="yii-db-baseactiverecord.html#$relatedRecords-detail">$relatedRecords</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>An array of related records indexed by relation names.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="$scenario">
        <td><a href="yii-base-model.html#$scenario-detail">$scenario</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>The scenario that this model is in.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="$validators">
        <td><a href="yii-base-model.html#$validators-detail">$validators</a></td>
        <td><a href="http://www.php.net/class.arrayobject">ArrayObject</a>|<a href="yii-validators-validator.html">yii\validators\Validator</a>[]</td>
        <td>All the validators declared in the model.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
    </table>
</div>

<a id="methods"></a>

<div class="summary doc-method">
<h2>Public Methods</h2>

<p><a href="#" class="toggle">Hide inherited methods</a></p>

<table class="summary-table table table-striped table-bordered table-hover">
<colgroup>
    <col class="col-method" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>
<tr>
  <th>Method</th><th>Description</th><th>Defined By</th>
</tr>
        <tr class="inherited" id="__call()">
        <td><a href="yii-base-object.html#__call()-detail">__call()</a></td>
        <td>Calls the named method which is not a class method.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="__clone()">
        <td><a href="yii-base-component.html#__clone()-detail">__clone()</a></td>
        <td>This method is called after the object is created by cloning an existing one.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="__construct()">
        <td><a href="yii-base-object.html#__construct()-detail">__construct()</a></td>
        <td>Constructor.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="__get()">
        <td><a href="yii-db-baseactiverecord.html#__get()-detail">__get()</a></td>
        <td>PHP getter magic method.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="__isset()">
        <td><a href="yii-db-baseactiverecord.html#__isset()-detail">__isset()</a></td>
        <td>Checks if a property value is null.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="__set()">
        <td><a href="yii-db-baseactiverecord.html#__set()-detail">__set()</a></td>
        <td>PHP setter magic method.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="__unset()">
        <td><a href="yii-db-baseactiverecord.html#__unset()-detail">__unset()</a></td>
        <td>Sets a component property to be null.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="activeAttributes()">
        <td><a href="yii-base-model.html#activeAttributes()-detail">activeAttributes()</a></td>
        <td>Returns the attribute names that are subject to validation in the current scenario.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="addError()">
        <td><a href="yii-base-model.html#addError()-detail">addError()</a></td>
        <td>Adds a new error to the specified attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="addErrors()">
        <td><a href="yii-base-model.html#addErrors()-detail">addErrors()</a></td>
        <td>Adds a list of errors.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="afterDelete()">
        <td><a href="yii-db-baseactiverecord.html#afterDelete()-detail">afterDelete()</a></td>
        <td>This method is invoked after deleting a record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="afterFind()">
        <td><a href="yii-db-baseactiverecord.html#afterFind()-detail">afterFind()</a></td>
        <td>This method is called when the AR object is created and populated with the query result.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="afterRefresh()">
        <td><a href="yii-db-baseactiverecord.html#afterRefresh()-detail">afterRefresh()</a></td>
        <td>This method is called when the AR object is refreshed.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="afterSave()">
        <td><a href="yii-db-baseactiverecord.html#afterSave()-detail">afterSave()</a></td>
        <td>This method is called at the end of inserting or updating a record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="afterValidate()">
        <td><a href="yii-base-model.html#afterValidate()-detail">afterValidate()</a></td>
        <td>This method is invoked after validation ends.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="attachBehavior()">
        <td><a href="yii-base-component.html#attachBehavior()-detail">attachBehavior()</a></td>
        <td>Attaches a behavior to this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="attachBehaviors()">
        <td><a href="yii-base-component.html#attachBehaviors()-detail">attachBehaviors()</a></td>
        <td>Attaches a list of behaviors to the component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="attributeHints()">
        <td><a href="yii-base-model.html#attributeHints()-detail">attributeHints()</a></td>
        <td>Returns the attribute hints.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="attributeLabels()">
        <td><a href="yii-base-model.html#attributeLabels()-detail">attributeLabels()</a></td>
        <td>Returns the attribute labels.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="attributes()">
        <td><a href="yii-db-activerecord.html#attributes()-detail">attributes()</a></td>
        <td>Returns the list of all attribute names of the model.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="beforeDelete()">
        <td><a href="yii-db-baseactiverecord.html#beforeDelete()-detail">beforeDelete()</a></td>
        <td>This method is invoked before deleting a record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="beforeSave()">
        <td><a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a></td>
        <td>This method is called at the beginning of inserting or updating a record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="beforeValidate()">
        <td><a href="yii-base-model.html#beforeValidate()-detail">beforeValidate()</a></td>
        <td>This method is invoked before validation starts.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="behaviors()">
        <td><a href="yii-base-component.html#behaviors()-detail">behaviors()</a></td>
        <td>Returns a list of behaviors that this component should behave as.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="canGetProperty()">
        <td><a href="yii-base-object.html#canGetProperty()-detail">canGetProperty()</a></td>
        <td>Returns a value indicating whether a property can be read.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="canSetProperty()">
        <td><a href="yii-base-object.html#canSetProperty()-detail">canSetProperty()</a></td>
        <td>Returns a value indicating whether a property can be set.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="className()">
        <td><a href="yii-base-object.html#className()-detail">className()</a></td>
        <td>Returns the fully qualified name of this class.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="clearErrors()">
        <td><a href="yii-base-model.html#clearErrors()-detail">clearErrors()</a></td>
        <td>Removes errors for all attributes or a single attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="createValidators()">
        <td><a href="yii-base-model.html#createValidators()-detail">createValidators()</a></td>
        <td>Creates validator objects based on the validation rules specified in <a href="yii-base-model.html#rules()-detail">rules()</a>.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="delete()">
        <td><a href="yii-db-activerecord.html#delete()-detail">delete()</a></td>
        <td>Deletes the table row corresponding to this active record.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr id="deleteAll()">
        <td><a href="yii-db-activerecord.html#deleteAll()-detail">deleteAll()</a></td>
        <td>Deletes rows in the table using the provided conditions.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
                <tr class="inherited" id="detachBehavior()">
        <td><a href="yii-base-component.html#detachBehavior()-detail">detachBehavior()</a></td>
        <td>Detaches a behavior from the component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="detachBehaviors()">
        <td><a href="yii-base-component.html#detachBehaviors()-detail">detachBehaviors()</a></td>
        <td>Detaches all behaviors from the component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="ensureBehaviors()">
        <td><a href="yii-base-component.html#ensureBehaviors()-detail">ensureBehaviors()</a></td>
        <td>Makes sure that the behaviors declared in <a href="yii-base-component.html#behaviors()-detail">behaviors()</a> are attached to this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="equals()">
        <td><a href="yii-db-activerecord.html#equals()-detail">equals()</a></td>
        <td>Returns a value indicating whether the given active record is the same as the current one.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="extraFields()">
        <td><a href="yii-base-arrayabletrait.html#extraFields()-detail">extraFields()</a></td>
        <td>Returns the list of fields that can be expanded further and returned by <a href="yii-base-arrayabletrait.html#toArray()-detail">toArray()</a>.</td>
        <td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td>
    </tr>
            <tr class="inherited" id="fields()">
        <td><a href="yii-base-arrayabletrait.html#fields()-detail">fields()</a></td>
        <td>Returns the list of fields that should be returned by default by <a href="yii-base-arrayabletrait.html#toArray()-detail">toArray()</a> when no specific fields are specified.</td>
        <td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td>
    </tr>
            <tr id="find()">
        <td><a href="yii-db-activerecord.html#find()-detail">find()</a></td>
        <td>Creates an <a href="yii-db-activequeryinterface.html">yii\db\ActiveQueryInterface</a> instance for query purpose.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="findAll()">
        <td><a href="yii-db-baseactiverecord.html#findAll()-detail">findAll()</a></td>
        <td>Returns a list of active record models that match the specified primary key value(s) or a set of column values.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
                <tr id="findBySql()">
        <td><a href="yii-db-activerecord.html#findBySql()-detail">findBySql()</a></td>
        <td>Creates an <a href="yii-db-activequery.html">yii\db\ActiveQuery</a> instance with a given SQL statement.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="findOne()">
        <td><a href="yii-db-baseactiverecord.html#findOne()-detail">findOne()</a></td>
        <td>Returns a single active record model instance by a primary key or an array of column values.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="formName()">
        <td><a href="yii-base-model.html#formName()-detail">formName()</a></td>
        <td>Returns the form name that this model class should use.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="generateAttributeLabel()">
        <td><a href="yii-base-model.html#generateAttributeLabel()-detail">generateAttributeLabel()</a></td>
        <td>Generates a user friendly attribute label based on the give attribute name.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getActiveValidators()">
        <td><a href="yii-base-model.html#getActiveValidators()-detail">getActiveValidators()</a></td>
        <td>Returns the validators applicable to the current <a href="yii-base-model.html#$scenario-detail">$scenario</a>.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getAttribute()">
        <td><a href="yii-db-baseactiverecord.html#getAttribute()-detail">getAttribute()</a></td>
        <td>Returns the named attribute value.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getAttributeHint()">
        <td><a href="yii-db-baseactiverecord.html#getAttributeHint()-detail">getAttributeHint()</a></td>
        <td>Returns the text hint for the specified attribute.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getAttributeLabel()">
        <td><a href="yii-db-baseactiverecord.html#getAttributeLabel()-detail">getAttributeLabel()</a></td>
        <td>Returns the text label for the specified attribute.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getAttributes()">
        <td><a href="yii-base-model.html#getAttributes()-detail">getAttributes()</a></td>
        <td>Returns attribute values.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getBehavior()">
        <td><a href="yii-base-component.html#getBehavior()-detail">getBehavior()</a></td>
        <td>Returns the named behavior object.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="getBehaviors()">
        <td><a href="yii-base-component.html#getBehaviors()-detail">getBehaviors()</a></td>
        <td>Returns all behaviors attached to this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="getDb()">
        <td><a href="yii-db-activerecord.html#getDb()-detail">getDb()</a></td>
        <td>Returns the database connection used by this AR class.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getDirtyAttributes()">
        <td><a href="yii-db-baseactiverecord.html#getDirtyAttributes()-detail">getDirtyAttributes()</a></td>
        <td>Returns the attribute values that have been modified since they are loaded or saved most recently.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getErrors()">
        <td><a href="yii-base-model.html#getErrors()-detail">getErrors()</a></td>
        <td>Returns the errors for all attribute or a single attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getFirstError()">
        <td><a href="yii-base-model.html#getFirstError()-detail">getFirstError()</a></td>
        <td>Returns the first error of the specified attribute.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getFirstErrors()">
        <td><a href="yii-base-model.html#getFirstErrors()-detail">getFirstErrors()</a></td>
        <td>Returns the first error of every attribute in the model.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getIsNewRecord()">
        <td><a href="yii-db-baseactiverecord.html#getIsNewRecord()-detail">getIsNewRecord()</a></td>
        <td>Returns a value indicating whether the current record is new.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getIterator()">
        <td><a href="yii-base-model.html#getIterator()-detail">getIterator()</a></td>
        <td>Returns an iterator for traversing the attributes in the model.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="getOldAttribute()">
        <td><a href="yii-db-baseactiverecord.html#getOldAttribute()-detail">getOldAttribute()</a></td>
        <td>Returns the old value of the named attribute.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getOldAttributes()">
        <td><a href="yii-db-baseactiverecord.html#getOldAttributes()-detail">getOldAttributes()</a></td>
        <td>Returns the old attribute values.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getOldPrimaryKey()">
        <td><a href="yii-db-baseactiverecord.html#getOldPrimaryKey()-detail">getOldPrimaryKey()</a></td>
        <td>Returns the old primary key value(s).</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getPrimaryKey()">
        <td><a href="yii-db-baseactiverecord.html#getPrimaryKey()-detail">getPrimaryKey()</a></td>
        <td>Returns the primary key value(s).</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getRelatedRecords()">
        <td><a href="yii-db-baseactiverecord.html#getRelatedRecords()-detail">getRelatedRecords()</a></td>
        <td>Returns all populated related records.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getRelation()">
        <td><a href="yii-db-baseactiverecord.html#getRelation()-detail">getRelation()</a></td>
        <td>Returns the relation object with the specified name.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getScenario()">
        <td><a href="yii-base-model.html#getScenario()-detail">getScenario()</a></td>
        <td>Returns the scenario that this model is used in.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="getTableSchema()">
        <td><a href="yii-db-activerecord.html#getTableSchema()-detail">getTableSchema()</a></td>
        <td>Returns the schema information of the DB table associated with this AR class.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="getValidators()">
        <td><a href="yii-base-model.html#getValidators()-detail">getValidators()</a></td>
        <td>Returns all the validators declared in <a href="yii-base-model.html#rules()-detail">rules()</a>.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="hasAttribute()">
        <td><a href="yii-db-baseactiverecord.html#hasAttribute()-detail">hasAttribute()</a></td>
        <td>Returns a value indicating whether the model has an attribute with the specified name.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="hasErrors()">
        <td><a href="yii-base-model.html#hasErrors()-detail">hasErrors()</a></td>
        <td>Returns a value indicating whether there is any validation error.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="hasEventHandlers()">
        <td><a href="yii-base-component.html#hasEventHandlers()-detail">hasEventHandlers()</a></td>
        <td>Returns a value indicating whether there is any handler attached to the named event.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="hasMany()">
        <td><a href="yii-db-baseactiverecord.html#hasMany()-detail">hasMany()</a></td>
        <td>Declares a <code>has-many</code> relation.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="hasMethod()">
        <td><a href="yii-base-object.html#hasMethod()-detail">hasMethod()</a></td>
        <td>Returns a value indicating whether a method is defined.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="hasOne()">
        <td><a href="yii-db-baseactiverecord.html#hasOne()-detail">hasOne()</a></td>
        <td>Declares a <code>has-one</code> relation.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="hasProperty()">
        <td><a href="yii-base-object.html#hasProperty()-detail">hasProperty()</a></td>
        <td>Returns a value indicating whether a property is defined.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="init()">
        <td><a href="yii-db-baseactiverecord.html#init()-detail">init()</a></td>
        <td>Initializes the object.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="insert()">
        <td><a href="yii-db-activerecord.html#insert()-detail">insert()</a></td>
        <td>Inserts a row into the associated database table using the attribute values of this record.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
                <tr class="inherited" id="instantiate()">
        <td><a href="yii-db-baseactiverecord.html#instantiate()-detail">instantiate()</a></td>
        <td>Creates an active record instance.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="isAttributeActive()">
        <td><a href="yii-base-model.html#isAttributeActive()-detail">isAttributeActive()</a></td>
        <td>Returns a value indicating whether the attribute is active in the current scenario.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="isAttributeChanged()">
        <td><a href="yii-db-baseactiverecord.html#isAttributeChanged()-detail">isAttributeChanged()</a></td>
        <td>Returns a value indicating whether the named attribute has been changed.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="isAttributeRequired()">
        <td><a href="yii-base-model.html#isAttributeRequired()-detail">isAttributeRequired()</a></td>
        <td>Returns a value indicating whether the attribute is required.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="isAttributeSafe()">
        <td><a href="yii-base-model.html#isAttributeSafe()-detail">isAttributeSafe()</a></td>
        <td>Returns a value indicating whether the attribute is safe for massive assignments.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="isPrimaryKey()">
        <td><a href="yii-db-baseactiverecord.html#isPrimaryKey()-detail">isPrimaryKey()</a></td>
        <td>Returns a value indicating whether the given set of attributes represents the primary key for this model</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="isRelationPopulated()">
        <td><a href="yii-db-baseactiverecord.html#isRelationPopulated()-detail">isRelationPopulated()</a></td>
        <td>Check whether the named relation has been populated with records.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="isTransactional()">
        <td><a href="yii-db-activerecord.html#isTransactional()-detail">isTransactional()</a></td>
        <td>Returns a value indicating whether the specified operation is transactional in the current <a href="yii-base-model.html#$scenario-detail">$scenario</a>.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="link()">
        <td><a href="yii-db-baseactiverecord.html#link()-detail">link()</a></td>
        <td>Establishes the relationship between two models.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="load()">
        <td><a href="yii-base-model.html#load()-detail">load()</a></td>
        <td>Populates the model with input data.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="loadDefaultValues()">
        <td><a href="yii-db-activerecord.html#loadDefaultValues()-detail">loadDefaultValues()</a></td>
        <td>Loads default values from database table schema</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="loadMultiple()">
        <td><a href="yii-base-model.html#loadMultiple()-detail">loadMultiple()</a></td>
        <td>Populates a set of models with the data from end user.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="markAttributeDirty()">
        <td><a href="yii-db-baseactiverecord.html#markAttributeDirty()-detail">markAttributeDirty()</a></td>
        <td>Marks an attribute dirty.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="off()">
        <td><a href="yii-base-component.html#off()-detail">off()</a></td>
        <td>Detaches an existing event handler from this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="offsetExists()">
        <td><a href="yii-db-baseactiverecord.html#offsetExists()-detail">offsetExists()</a></td>
        <td>Returns whether there is an element at the specified offset.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="offsetGet()">
        <td><a href="yii-base-model.html#offsetGet()-detail">offsetGet()</a></td>
        <td>Returns the element at the specified offset.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="offsetSet()">
        <td><a href="yii-base-model.html#offsetSet()-detail">offsetSet()</a></td>
        <td>Sets the element at the specified offset.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="offsetUnset()">
        <td><a href="yii-db-baseactiverecord.html#offsetUnset()-detail">offsetUnset()</a></td>
        <td>Sets the element value at the specified offset to null.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="on()">
        <td><a href="yii-base-component.html#on()-detail">on()</a></td>
        <td>Attaches an event handler to an event.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="onUnsafeAttribute()">
        <td><a href="yii-base-model.html#onUnsafeAttribute()-detail">onUnsafeAttribute()</a></td>
        <td>This method is invoked when an unsafe attribute is being massively assigned.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="optimisticLock()">
        <td><a href="yii-db-baseactiverecord.html#optimisticLock()-detail">optimisticLock()</a></td>
        <td>Returns the name of the column that stores the lock version for implementing optimistic locking.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="populateRecord()">
        <td><a href="yii-db-activerecord.html#populateRecord()-detail">populateRecord()</a></td>
        <td>Populates an active record object using a row of data from the database/storage.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="populateRelation()">
        <td><a href="yii-db-baseactiverecord.html#populateRelation()-detail">populateRelation()</a></td>
        <td>Populates the named relation with the related records.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="primaryKey()">
        <td><a href="yii-db-activerecord.html#primaryKey()-detail">primaryKey()</a></td>
        <td>Returns the primary key name(s) for this AR class.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="refresh()">
        <td><a href="yii-db-baseactiverecord.html#refresh()-detail">refresh()</a></td>
        <td>Repopulates this active record with the latest data.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
                <tr class="inherited" id="rules()">
        <td><a href="yii-base-model.html#rules()-detail">rules()</a></td>
        <td>Returns the validation rules for attributes.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="safeAttributes()">
        <td><a href="yii-base-model.html#safeAttributes()-detail">safeAttributes()</a></td>
        <td>Returns the attribute names that are safe to be massively assigned in the current scenario.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="save()">
        <td><a href="yii-db-baseactiverecord.html#save()-detail">save()</a></td>
        <td>Saves the current record.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="scenarios()">
        <td><a href="yii-base-model.html#scenarios()-detail">scenarios()</a></td>
        <td>Returns a list of scenarios and the corresponding active attributes.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="setAttribute()">
        <td><a href="yii-db-baseactiverecord.html#setAttribute()-detail">setAttribute()</a></td>
        <td>Sets the named attribute value.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="setAttributes()">
        <td><a href="yii-base-model.html#setAttributes()-detail">setAttributes()</a></td>
        <td>Sets the attribute values in a massive way.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="setIsNewRecord()">
        <td><a href="yii-db-baseactiverecord.html#setIsNewRecord()-detail">setIsNewRecord()</a></td>
        <td>Sets the value indicating whether the record is new.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="setOldAttribute()">
        <td><a href="yii-db-baseactiverecord.html#setOldAttribute()-detail">setOldAttribute()</a></td>
        <td>Sets the old value of the named attribute.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="setOldAttributes()">
        <td><a href="yii-db-baseactiverecord.html#setOldAttributes()-detail">setOldAttributes()</a></td>
        <td>Sets the old attribute values.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="setScenario()">
        <td><a href="yii-base-model.html#setScenario()-detail">setScenario()</a></td>
        <td>Sets the scenario for the model.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr id="tableName()">
        <td><a href="yii-db-activerecord.html#tableName()-detail">tableName()</a></td>
        <td>Declares the name of the database table associated with this AR class.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="toArray()">
        <td><a href="yii-base-arrayabletrait.html#toArray()-detail">toArray()</a></td>
        <td>Converts the model into an array.</td>
        <td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td>
    </tr>
            <tr id="transactions()">
        <td><a href="yii-db-activerecord.html#transactions()-detail">transactions()</a></td>
        <td>Declares which DB operations should be performed within a transaction in different scenarios.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="trigger()">
        <td><a href="yii-base-component.html#trigger()-detail">trigger()</a></td>
        <td>Triggers an event.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="unlink()">
        <td><a href="yii-db-baseactiverecord.html#unlink()-detail">unlink()</a></td>
        <td>Destroys the relationship between two models.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="unlinkAll()">
        <td><a href="yii-db-baseactiverecord.html#unlinkAll()-detail">unlinkAll()</a></td>
        <td>Destroys the relationship in current model.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr id="update()">
        <td><a href="yii-db-activerecord.html#update()-detail">update()</a></td>
        <td>Saves the changes to this active record into the associated database table.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr id="updateAll()">
        <td><a href="yii-db-activerecord.html#updateAll()-detail">updateAll()</a></td>
        <td>Updates the whole table using the provided attribute values and conditions.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr id="updateAllCounters()">
        <td><a href="yii-db-activerecord.html#updateAllCounters()-detail">updateAllCounters()</a></td>
        <td>Updates the whole table using the provided counter changes and conditions.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="updateAttributes()">
        <td><a href="yii-db-baseactiverecord.html#updateAttributes()-detail">updateAttributes()</a></td>
        <td>Updates the specified attributes.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            <tr class="inherited" id="updateCounters()">
        <td><a href="yii-db-baseactiverecord.html#updateCounters()-detail">updateCounters()</a></td>
        <td>Updates one or several counter columns for the current AR object.</td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
                <tr class="inherited" id="validate()">
        <td><a href="yii-base-model.html#validate()-detail">validate()</a></td>
        <td>Performs the data validation.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
            <tr class="inherited" id="validateMultiple()">
        <td><a href="yii-base-model.html#validateMultiple()-detail">validateMultiple()</a></td>
        <td>Validates multiple models.</td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
    </table>
</div>

<div class="summary doc-method">
<h2>Protected Methods</h2>

<p><a href="#" class="toggle">Hide inherited methods</a></p>

<table class="summary-table table table-striped table-bordered table-hover">
<colgroup>
    <col class="col-method" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>
<tr>
  <th>Method</th><th>Description</th><th>Defined By</th>
</tr>
                                                                                                                                    <tr id="deleteInternal()">
        <td><a href="yii-db-activerecord.html#deleteInternal()-detail">deleteInternal()</a></td>
        <td>Deletes an ActiveRecord without considering transaction.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
                                            <tr id="findByCondition()">
        <td><a href="yii-db-activerecord.html#findByCondition()-detail">findByCondition()</a></td>
        <td>Finds ActiveRecord instance(s) by the given condition.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
                                                                                                                                                            <tr id="insertInternal()">
        <td><a href="yii-db-activerecord.html#insertInternal()-detail">insertInternal()</a></td>
        <td>Inserts an ActiveRecord into DB without considering transaction.</td>
        <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
    </tr>
                                                                                                                <tr class="inherited" id="resolveFields()">
        <td><a href="yii-base-arrayabletrait.html#resolveFields()-detail">resolveFields()</a></td>
        <td>Determines which fields can be returned by <a href="yii-base-arrayabletrait.html#toArray()-detail">toArray()</a>.</td>
        <td><a href="yii-base-arrayabletrait.html">yii\base\ArrayableTrait</a></td>
    </tr>
                                                                                                <tr class="inherited" id="updateInternal()">
        <td><a href="yii-db-baseactiverecord.html#updateInternal()-detail">updateInternal()</a></td>
        <td></td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
            </table>
</div>

<a id="events"></a>
<div class="summary doc-event">
    <h2>Events</h2>

    <p><a href="#" class="toggle">Hide inherited events</a></p>

    <table class="summary-table table table-striped table-bordered table-hover">
    <colgroup>
        <col class="col-event" />
        <col class="col-type" />
        <col class="col-description" />
        <col class="col-defined" />
    </colgroup>
    <tr>
        <th>Event</th><th>Type</th><th>Description</th><th>Defined By</th>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_DELETE">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_DELETE-detail">EVENT_AFTER_DELETE</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event that is triggered after a record is deleted.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_FIND">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_FIND-detail">EVENT_AFTER_FIND</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event that is triggered after the record is created and populated with query result.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_INSERT">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_INSERT-detail">EVENT_AFTER_INSERT</a></td>
        <td><a href="yii-db-aftersaveevent.html">yii\db\AfterSaveEvent</a></td>
        <td>
            An event that is triggered after a record is inserted.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_REFRESH">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_REFRESH-detail">EVENT_AFTER_REFRESH</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event that is triggered after a record is refreshed.                            (available since version 2.0.8)
                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_UPDATE">
        <td><a href="yii-db-baseactiverecord.html#EVENT_AFTER_UPDATE-detail">EVENT_AFTER_UPDATE</a></td>
        <td><a href="yii-db-aftersaveevent.html">yii\db\AfterSaveEvent</a></td>
        <td>
            An event that is triggered after a record is updated.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_AFTER_VALIDATE">
        <td><a href="yii-base-model.html#EVENT_AFTER_VALIDATE-detail">EVENT_AFTER_VALIDATE</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event raised at the end of <a href="yii-base-model.html#validate()-detail">validate()</a>                    </td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
        <tr class="inherited" id="EVENT_BEFORE_DELETE">
        <td><a href="yii-db-baseactiverecord.html#EVENT_BEFORE_DELETE-detail">EVENT_BEFORE_DELETE</a></td>
        <td><a href="yii-base-modelevent.html">yii\base\ModelEvent</a></td>
        <td>
            An event that is triggered before deleting a record.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_BEFORE_INSERT">
        <td><a href="yii-db-baseactiverecord.html#EVENT_BEFORE_INSERT-detail">EVENT_BEFORE_INSERT</a></td>
        <td><a href="yii-base-modelevent.html">yii\base\ModelEvent</a></td>
        <td>
            An event that is triggered before inserting a record.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_BEFORE_UPDATE">
        <td><a href="yii-db-baseactiverecord.html#EVENT_BEFORE_UPDATE-detail">EVENT_BEFORE_UPDATE</a></td>
        <td><a href="yii-base-modelevent.html">yii\base\ModelEvent</a></td>
        <td>
            An event that is triggered before updating a record.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        <tr class="inherited" id="EVENT_BEFORE_VALIDATE">
        <td><a href="yii-base-model.html#EVENT_BEFORE_VALIDATE-detail">EVENT_BEFORE_VALIDATE</a></td>
        <td><a href="yii-base-modelevent.html">yii\base\ModelEvent</a></td>
        <td>
            An event raised at the beginning of <a href="yii-base-model.html#validate()-detail">validate()</a>.                    </td>
        <td><a href="yii-base-model.html">yii\base\Model</a></td>
    </tr>
        <tr class="inherited" id="EVENT_INIT">
        <td><a href="yii-db-baseactiverecord.html#EVENT_INIT-detail">EVENT_INIT</a></td>
        <td><a href="yii-base-event.html">yii\base\Event</a></td>
        <td>
            An event that is triggered when the record is initialized via <a href="yii-db-baseactiverecord.html#init()-detail">init()</a>.                    </td>
        <td><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
    </tr>
        </table>
</div>

<a id="constants"></a>
<div class="summary doc-const">
    <h2>Constants</h2>

    <p><a href="#" class="toggle">Hide inherited constants</a></p>

    <table class="summary-table table table-striped table-bordered table-hover">
    <colgroup>
        <col class="col-const" />
        <col class="col-value" />
        <col class="col-description" />
        <col class="col-defined" />
    </colgroup>
    <tr>
        <th>Constant</th><th>Value</th><th>Description</th><th>Defined By</th>
    </tr>
            <tr id="OP_ALL">
          <td id="OP_ALL-detail">OP_ALL</td>
          <td>7</td>
          <td>All three operations: insert, update, delete.
This is a shortcut of the expression: OP_INSERT | OP_UPDATE | OP_DELETE.</td>
          <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
        </tr>
            <tr id="OP_DELETE">
          <td id="OP_DELETE-detail">OP_DELETE</td>
          <td>4</td>
          <td>The delete operation. This is mainly used when overriding <a href="yii-db-activerecord.html#transactions()-detail">transactions()</a> to specify which operations are transactional.
</td>
          <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
        </tr>
            <tr id="OP_INSERT">
          <td id="OP_INSERT-detail">OP_INSERT</td>
          <td>1</td>
          <td>The insert operation. This is mainly used when overriding <a href="yii-db-activerecord.html#transactions()-detail">transactions()</a> to specify which operations are transactional.
</td>
          <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
        </tr>
            <tr id="OP_UPDATE">
          <td id="OP_UPDATE-detail">OP_UPDATE</td>
          <td>2</td>
          <td>The update operation. This is mainly used when overriding <a href="yii-db-activerecord.html#transactions()-detail">transactions()</a> to specify which operations are transactional.
</td>
          <td><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
        </tr>
            <tr class="inherited" id="SCENARIO_DEFAULT">
          <td id="SCENARIO_DEFAULT-detail">SCENARIO_DEFAULT</td>
          <td>'default'</td>
          <td>The name of the default scenario.
</td>
          <td><a href="yii-base-model.html">yii\base\Model</a></td>
        </tr>
        </table>
</div>

<h2>Method Details</h2>

<div class="method-doc">

    <div class="detail-header h3" id="attributes()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#attributes()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L328" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L328" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        attributes()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the list of all attribute names of the model.</strong></p>

        <p>The default implementation will return all column names of the table associated with this AR class.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <strong><a href="yii-db-activerecord.html#attributes()-detail">attributes</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>List of attribute names.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="delete()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#delete()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L570" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L570" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        delete()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Deletes the table row corresponding to this active record.</strong></p>

        <p>This method performs the following steps in order:</p>
<ol>
<li>call <a href="yii-db-baseactiverecord.html#beforeDelete()-detail">beforeDelete()</a>. If the method returns false, it will skip the
rest of the steps;</li>
<li>delete the record from the database;</li>
<li>call <a href="yii-db-baseactiverecord.html#afterDelete()-detail">afterDelete()</a>.</li>
</ol>
<p>In the above step 1 and 3, events named <a href="yii-db-baseactiverecord.html#EVENT_BEFORE_DELETE-detail">EVENT_BEFORE_DELETE</a> and <a href="yii-db-baseactiverecord.html#EVENT_AFTER_DELETE-detail">EVENT_AFTER_DELETE</a>
will be raised by the corresponding methods.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">false</a></span> <strong><a href="yii-db-activerecord.html#delete()-detail">delete</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">false</a></td>
                  <td class="param-desc-col"><p>The number of rows deleted, or false if the deletion is unsuccessful for some reason.
Note that it is possible the number of rows deleted is 0, even though the deletion execution is successful.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-db-staleobjectexception.html">yii\db\StaleObjectException</a></td>
                  <td class="param-desc-col"><p>if <a href="yii-db-baseactiverecord.html#optimisticLock()-detail">optimistic locking</a> is enabled and the data
being deleted is outdated.</p>
</td>
                </tr>
                            <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="http://www.php.net/class.exception">Exception</a></td>
                  <td class="param-desc-col"><p>in case delete failed.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="deleteAll()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#deleteAll()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L257" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L257" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        deleteAll()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Deletes rows in the table using the provided conditions.</strong></p>

        <p>WARNING: If you do not specify any condition, this method will delete ALL rows in the table.</p>
<p>For example, to delete all customers whose status is 3:</p>
<pre><code class="hljs php language-php">Customer::deleteAll(<span class="hljs-string">'status = 3'</span>);
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a></span> <strong><a href="yii-db-activerecord.html#deleteAll()-detail">deleteAll</a></strong> ( <span style="color: #0000BB">$condition&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span>, <span style="color: #0000BB">$params&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a>|<a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The conditions that will be put in the WHERE part of the DELETE SQL.
Please refer to <a href="yii-db-query.html#where()-detail">yii\db\Query::where()</a> on how to specify this parameter.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$params</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The parameters (name =&gt; value) to be bound to the query.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a></td>
                  <td class="param-desc-col"><p>The number of rows deleted</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="deleteInternal()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#deleteInternal()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L597" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L597" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        deleteInternal()
        <span class="detail-header-tag small">
            protected                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Deletes an ActiveRecord without considering transaction.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">protected</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">false</a></span> <strong><a href="yii-db-activerecord.html#deleteInternal()-detail">deleteInternal</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">false</a></td>
                  <td class="param-desc-col"><p>The number of rows deleted, or false if the deletion is unsuccessful for some reason.
Note that it is possible the number of rows deleted is 0, even though the deletion execution is successful.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-db-staleobjectexception.html">yii\db\StaleObjectException</a></td>
                  <td class="param-desc-col"></td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="equals()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#equals()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L627" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L627" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        equals()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns a value indicating whether the given active record is the same as the current one.</strong></p>

        <p>The comparison is made by comparing the table names and the primary key values of the two active records.
If one of the records <a href="yii-db-baseactiverecord.html#$isNewRecord-detail">is new</a> they are also considered not equal.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-db-activerecord.html#equals()-detail">equals</a></strong> ( <span style="color: #0000BB">$record</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$record</span></td>
                  <td class="param-type-col"><a href="yii-db-activerecord.html">yii\db\ActiveRecord</a></td>
                  <td class="param-desc-col"><p>Record to compare to</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether the two active records refer to the same row in the same database table.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="find()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#find()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L269" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L269" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        find()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Creates an <a href="yii-db-activequeryinterface.html">yii\db\ActiveQueryInterface</a> instance for query purpose.</strong></p>

        <p>The returned <a href="yii-db-activequeryinterface.html">yii\db\ActiveQueryInterface</a> instance can be further customized by calling
methods defined in <a href="yii-db-activequeryinterface.html">yii\db\ActiveQueryInterface</a> before <code>one()</code> or <code>all()</code> is called to return
populated ActiveRecord instances. For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-comment">// find the customer whose ID is 1</span>
<span class="hljs-variable">$customer</span> = Customer::find()-&gt;where([<span class="hljs-string">'id'</span> =&gt; <span class="hljs-number">1</span>])-&gt;one();

<span class="hljs-comment">// find all active customers and order them by their age:</span>
<span class="hljs-variable">$customers</span> = Customer::find()
    -&gt;where([<span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">1</span>])
    -&gt;orderBy(<span class="hljs-string">'age'</span>)
    -&gt;all();
</code></pre>
<p>This method is also called by <a href="yii-db-baseactiverecord.html#hasOne()-detail">yii\db\BaseActiveRecord::hasOne()</a> and <a href="yii-db-baseactiverecord.html#hasMany()-detail">yii\db\BaseActiveRecord::hasMany()</a> to
create a relational query.</p>
<p>You may override this method to return a customized query. For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Customer</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ActiveRecord</span>
</span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">find</span><span class="hljs-params">()</span>
    </span>{
        <span class="hljs-comment">// use CustomerQuery instead of the default ActiveQuery</span>
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> CustomerQuery(get_called_class());
    }
}
</code></pre>
<p>The following code shows how to apply a default condition for all queries:</p>
<pre><code class="hljs php language-php"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Customer</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ActiveRecord</span>
</span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">find</span><span class="hljs-params">()</span>
    </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">parent</span>::find()-&gt;where([<span class="hljs-string">'deleted'</span> =&gt; <span class="hljs-keyword">false</span>]);
    }
}

<span class="hljs-comment">// Use andWhere()/orWhere() to apply the default condition</span>
<span class="hljs-comment">// SELECT FROM customer WHERE `deleted`=:deleted AND age&gt;30</span>
<span class="hljs-variable">$customers</span> = Customer::find()-&gt;andWhere(<span class="hljs-string">'age&gt;30'</span>)-&gt;all();

<span class="hljs-comment">// Use where() to ignore the default condition</span>
<span class="hljs-comment">// SELECT FROM customer WHERE age&gt;30</span>
<span class="hljs-variable">$customers</span> = Customer::find()-&gt;where(<span class="hljs-string">'age&gt;30'</span>)-&gt;all();


</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="yii-db-activequery.html">yii\db\ActiveQuery</a></span> <strong><a href="yii-db-activerecord.html#find()-detail">find</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-activequery.html">yii\db\ActiveQuery</a></td>
                  <td class="param-desc-col"><p>The newly created <a href="yii-db-activequery.html">yii\db\ActiveQuery</a> instance.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="findByCondition()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#findByCondition()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L170" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L170" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        findByCondition()
        <span class="detail-header-tag small">
            protected                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Finds ActiveRecord instance(s) by the given condition.</strong></p>

        <p>This method is internally called by <a href="yii-db-baseactiverecord.html#findOne()-detail">findOne()</a> and <a href="yii-db-baseactiverecord.html#findAll()-detail">findAll()</a>.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">protected static</span> <span class="signature-type"><a href="yii-db-activequeryinterface.html">yii\db\ActiveQueryInterface</a></span> <strong><a href="yii-db-activerecord.html#findByCondition()-detail">findByCondition</a></strong> ( <span style="color: #0000BB">$condition</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>Please refer to <a href="yii-db-baseactiverecord.html#findOne()-detail">findOne()</a> for the explanation of this parameter</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-activequeryinterface.html">yii\db\ActiveQueryInterface</a></td>
                  <td class="param-desc-col"><p>The newly created <a href="yii-db-activequeryinterface.html">ActiveQuery</a> instance.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-base-invalidconfigexception.html">yii\base\InvalidConfigException</a></td>
                  <td class="param-desc-col"><p>if there is no primary key defined</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="findBySql()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#findBySql()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L154" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L154" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        findBySql()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Creates an <a href="yii-db-activequery.html">yii\db\ActiveQuery</a> instance with a given SQL statement.</strong></p>

        <p>Note that because the SQL statement is already specified, calling additional
query modification methods (such as <code>where()</code>, <code>order()</code>) on the created <a href="yii-db-activequery.html">yii\db\ActiveQuery</a>
instance will have no effect. However, calling <code>with()</code>, <code>asArray()</code> or <code>indexBy()</code> is
still fine.</p>
<p>Below is an example:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$customers</span> = Customer::findBySql(<span class="hljs-string">'SELECT * FROM customer'</span>)-&gt;all();
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="yii-db-activequery.html">yii\db\ActiveQuery</a></span> <strong><a href="yii-db-activerecord.html#findBySql()-detail">findBySql</a></strong> ( <span style="color: #0000BB">$sql</span>, <span style="color: #0000BB">$params&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$sql</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The SQL statement to be executed</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$params</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Parameters to be bound to the SQL statement during execution.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-activequery.html">yii\db\ActiveQuery</a></td>
                  <td class="param-desc-col"><p>The newly created <a href="yii-db-activequery.html">yii\db\ActiveQuery</a> instance</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getDb()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#getDb()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L131" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L131" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getDb()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the database connection used by this AR class.</strong></p>

        <p>By default, the "db" application component is used as the database connection.
You may override this method if you want to use a different database connection.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="yii-db-connection.html">yii\db\Connection</a></span> <strong><a href="yii-db-activerecord.html#getDb()-detail">getDb</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-connection.html">yii\db\Connection</a></td>
                  <td class="param-desc-col"><p>The database connection used by this AR class.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getTableSchema()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#getTableSchema()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L292" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L292" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getTableSchema()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the schema information of the DB table associated with this AR class.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="yii-db-tableschema.html">yii\db\TableSchema</a></span> <strong><a href="yii-db-activerecord.html#getTableSchema()-detail">getTableSchema</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-tableschema.html">yii\db\TableSchema</a></td>
                  <td class="param-desc-col"><p>The schema information of the DB table associated with this AR class.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-base-invalidconfigexception.html">yii\base\InvalidConfigException</a></td>
                  <td class="param-desc-col"><p>if the table for the AR class does not exist.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="insert()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#insert()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L419" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L419" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        insert()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Inserts a row into the associated database table using the attribute values of this record.</strong></p>

        <p>This method performs the following steps in order:</p>
<ol>
<li>call <a href="yii-base-model.html#beforeValidate()-detail">beforeValidate()</a> when <code>$runValidation</code> is true. If <a href="yii-base-model.html#beforeValidate()-detail">beforeValidate()</a>
returns <code>false</code>, the rest of the steps will be skipped;</li>
<li>call <a href="yii-base-model.html#afterValidate()-detail">afterValidate()</a> when <code>$runValidation</code> is true. If validation
failed, the rest of the steps will be skipped;</li>
<li>call <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a>. If <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a> returns <code>false</code>,
the rest of the steps will be skipped;</li>
<li>insert the record into database. If this fails, it will skip the rest of the steps;</li>
<li>call <a href="yii-db-baseactiverecord.html#afterSave()-detail">afterSave()</a>;</li>
</ol>
<p>In the above step 1, 2, 3 and 5, events <a href="yii-base-model.html#EVENT_BEFORE_VALIDATE-detail">EVENT_BEFORE_VALIDATE</a>,
<a href="yii-base-model.html#EVENT_AFTER_VALIDATE-detail">EVENT_AFTER_VALIDATE</a>, <a href="yii-db-baseactiverecord.html#EVENT_BEFORE_INSERT-detail">EVENT_BEFORE_INSERT</a>, and <a href="yii-db-baseactiverecord.html#EVENT_AFTER_INSERT-detail">EVENT_AFTER_INSERT</a>
will be raised by the corresponding methods.</p>
<p>Only the <a href="yii-db-baseactiverecord.html#$dirtyAttributes-detail">changed attribute values</a> will be inserted into database.</p>
<p>If the table's primary key is auto-incremental and is null during insertion,
it will be populated with the actual value after insertion.</p>
<p>For example, to insert a customer record:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$customer</span> = <span class="hljs-keyword">new</span> Customer;
<span class="hljs-variable">$customer</span>-&gt;name = <span class="hljs-variable">$name</span>;
<span class="hljs-variable">$customer</span>-&gt;email = <span class="hljs-variable">$email</span>;
<span class="hljs-variable">$customer</span>-&gt;insert();
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-db-activerecord.html#insert()-detail">insert</a></strong> ( <span style="color: #0000BB">$runValidation&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span>, <span style="color: #0000BB">$attributes&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$runValidation</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether to perform validation (calling <a href="yii-base-model.html#validate()-detail">validate()</a>)
before saving the record. Defaults to <code>true</code>. If the validation fails, the record
will not be saved to the database and this method will return <code>false</code>.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$attributes</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>List of attributes that need to be saved. Defaults to null,
meaning all attributes that are loaded from DB will be saved.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether the attributes are valid and the record is inserted successfully.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="http://www.php.net/class.exception">Exception</a></td>
                  <td class="param-desc-col"><p>in case insert failed.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="insertInternal()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#insertInternal()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L451" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L451" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        insertInternal()
        <span class="detail-header-tag small">
            protected                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Inserts an ActiveRecord into DB without considering transaction.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">protected</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-db-activerecord.html#insertInternal()-detail">insertInternal</a></strong> ( <span style="color: #0000BB">$attributes&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$attributes</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>List of attributes that need to be saved. Defaults to null,
meaning all attributes that are loaded from DB will be saved.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether the record is inserted successfully.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="isTransactional()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#isTransactional()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L641" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L641" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        isTransactional()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns a value indicating whether the specified operation is transactional in the current <a href="yii-base-model.html#$scenario-detail">$scenario</a>.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-db-activerecord.html#isTransactional()-detail">isTransactional</a></strong> ( <span style="color: #0000BB">$operation</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$operation</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a></td>
                  <td class="param-desc-col"><p>The operation to check. Possible values are <a href="yii-db-activerecord.html#OP_INSERT-detail">OP_INSERT</a>, <a href="yii-db-activerecord.html#OP_UPDATE-detail">OP_UPDATE</a> and <a href="yii-db-activerecord.html#OP_DELETE-detail">OP_DELETE</a>.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether the specified operation is transactional in the current <a href="yii-base-model.html#$scenario-detail">$scenario</a>.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="loadDefaultValues()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#loadDefaultValues()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L115" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L115" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        loadDefaultValues()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Loads default values from database table schema</strong></p>

        <p>You may call this method to load default values after creating a new instance:</p>
<pre><code class="hljs php language-php"><span class="hljs-comment">// class Customer extends \yii\db\ActiveRecord</span>
<span class="hljs-variable">$customer</span> = <span class="hljs-keyword">new</span> Customer();
<span class="hljs-variable">$customer</span>-&gt;loadDefaultValues();
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-activerecord.html">$this</a></span> <strong><a href="yii-db-activerecord.html#loadDefaultValues()-detail">loadDefaultValues</a></strong> ( <span style="color: #0000BB">$skipIfSet&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$skipIfSet</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether existing value should be preserved.
This will only set defaults for attributes that are <code>null</code>.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-activerecord.html">$this</a></td>
                  <td class="param-desc-col"><p>The model instance itself.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="populateRecord()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#populateRecord()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L368" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L368" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        populateRecord()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Populates an active record object using a row of data from the database/storage.</strong></p>

        <p>This is an internal method meant to be called to create active record objects after
fetching data from the database. It is mainly used by <a href="yii-db-activequery.html">yii\db\ActiveQuery</a> to populate
the query results into active records.</p>
<p>When calling this method manually you should call <a href="yii-db-baseactiverecord.html#afterFind()-detail">afterFind()</a> on the created
record to trigger the <a href="yii-db-baseactiverecord.html#EVENT_AFTER_FIND-detail">afterFind Event</a>.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type">void</span> <strong><a href="yii-db-activerecord.html#populateRecord()-detail">populateRecord</a></strong> ( <span style="color: #0000BB">$record</span>, <span style="color: #0000BB">$row</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$record</span></td>
                  <td class="param-type-col"><a href="yii-db-baseactiverecord.html">yii\db\BaseActiveRecord</a></td>
                  <td class="param-desc-col"><p>The record to be populated. In most cases this will be an instance
created by <a href="yii-db-baseactiverecord.html#instantiate()-detail">instantiate()</a> beforehand.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$row</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Attribute values (name =&gt; value)</p>
</td>
                </tr>
                                                </table>

<!--	-->

    <div class="detail-header h3" id="primaryKey()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#primaryKey()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L318" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L318" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        primaryKey()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the primary key name(s) for this AR class.</strong></p>

        <p>The default implementation will return the primary key(s) as declared
in the DB table that is associated with this AR class.</p>
<p>If the DB table does not declare any primary key, you should override
this method to return the attributes that you want to use as primary keys
for this AR class.</p>
<p>Note that an array should be returned even for a table with single primary key.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a>[]</span> <strong><a href="yii-db-activerecord.html#primaryKey()-detail">primaryKey</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a>[]</td>
                  <td class="param-desc-col"><p>The primary keys of the associated database table.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="tableName()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#tableName()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L282" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L282" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        tableName()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Declares the name of the database table associated with this AR class.</strong></p>

        <p>By default this method returns the class name as the table name by calling <a href="yii-helpers-baseinflector.html#camel2id()-detail">yii\helpers\Inflector::camel2id()</a>
with prefix <a href="yii-db-connection.html#$tablePrefix-detail">yii\db\Connection::$tablePrefix</a>. For example if <a href="yii-db-connection.html#$tablePrefix-detail">yii\db\Connection::$tablePrefix</a> is 'tbl_',
'Customer' becomes 'tbl_customer', and 'OrderItem' becomes 'tbl_order_item'. You may override this method
if the table is not named after this convention.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-db-activerecord.html#tableName()-detail">tableName</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The table name</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="transactions()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#transactions()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L360" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L360" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        transactions()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Declares which DB operations should be performed within a transaction in different scenarios.</strong></p>

        <p>The supported DB operations are: <a href="yii-db-activerecord.html#OP_INSERT-detail">OP_INSERT</a>, <a href="yii-db-activerecord.html#OP_UPDATE-detail">OP_UPDATE</a> and <a href="yii-db-activerecord.html#OP_DELETE-detail">OP_DELETE</a>,
which correspond to the <a href="yii-db-activerecord.html#insert()-detail">insert()</a>, <a href="yii-db-activerecord.html#update()-detail">update()</a> and <a href="yii-db-activerecord.html#delete()-detail">delete()</a> methods, respectively.
By default, these methods are NOT enclosed in a DB transaction.</p>
<p>In some scenarios, to ensure data consistency, you may want to enclose some or all of them
in transactions. You can do so by overriding this method and returning the operations
that need to be transactional. For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-keyword">return</span> [
    <span class="hljs-string">'admin'</span> =&gt; <span class="hljs-keyword">self</span>::OP_INSERT,
    <span class="hljs-string">'api'</span> =&gt; <span class="hljs-keyword">self</span>::OP_INSERT | <span class="hljs-keyword">self</span>::OP_UPDATE | <span class="hljs-keyword">self</span>::OP_DELETE,
    <span class="hljs-comment">// the above is equivalent to the following:</span>
    <span class="hljs-comment">// 'api' =&gt; self::OP_ALL,</span>

];
</code></pre>
<p>The above declaration specifies that in the "admin" scenario, the insert operation (<a href="yii-db-activerecord.html#insert()-detail">insert()</a>)
should be done in a transaction; and in the "api" scenario, all the operations should be done
in a transaction.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <strong><a href="yii-db-activerecord.html#transactions()-detail">transactions</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The declarations of transactional operations. The array keys are scenarios names,
and the array values are the corresponding transaction operations.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="update()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#update()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L525" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L525" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        update()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Saves the changes to this active record into the associated database table.</strong></p>

        <p>This method performs the following steps in order:</p>
<ol>
<li>call <a href="yii-base-model.html#beforeValidate()-detail">beforeValidate()</a> when <code>$runValidation</code> is true. If <a href="yii-base-model.html#beforeValidate()-detail">beforeValidate()</a>
returns <code>false</code>, the rest of the steps will be skipped;</li>
<li>call <a href="yii-base-model.html#afterValidate()-detail">afterValidate()</a> when <code>$runValidation</code> is true. If validation
failed, the rest of the steps will be skipped;</li>
<li>call <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a>. If <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a> returns <code>false</code>,
the rest of the steps will be skipped;</li>
<li>save the record into database. If this fails, it will skip the rest of the steps;</li>
<li>call <a href="yii-db-baseactiverecord.html#afterSave()-detail">afterSave()</a>;</li>
</ol>
<p>In the above step 1, 2, 3 and 5, events <a href="yii-base-model.html#EVENT_BEFORE_VALIDATE-detail">EVENT_BEFORE_VALIDATE</a>,
<a href="yii-base-model.html#EVENT_AFTER_VALIDATE-detail">EVENT_AFTER_VALIDATE</a>, <a href="yii-db-baseactiverecord.html#EVENT_BEFORE_UPDATE-detail">EVENT_BEFORE_UPDATE</a>, and <a href="yii-db-baseactiverecord.html#EVENT_AFTER_UPDATE-detail">EVENT_AFTER_UPDATE</a>
will be raised by the corresponding methods.</p>
<p>Only the <a href="yii-db-baseactiverecord.html#$dirtyAttributes-detail">changed attribute values</a> will be saved into database.</p>
<p>For example, to update a customer record:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$customer</span> = Customer::findOne(<span class="hljs-variable">$id</span>);
<span class="hljs-variable">$customer</span>-&gt;name = <span class="hljs-variable">$name</span>;
<span class="hljs-variable">$customer</span>-&gt;email = <span class="hljs-variable">$email</span>;
<span class="hljs-variable">$customer</span>-&gt;update();
</code></pre>
<p>Note that it is possible the update does not affect any row in the table.
In this case, this method will return 0. For this reason, you should use the following
code to check if update() is successful or not:</p>
<pre><code class="hljs php language-php"><span class="hljs-keyword">if</span> (<span class="hljs-variable">$customer</span>-&gt;update() !== <span class="hljs-keyword">false</span>) {
    <span class="hljs-comment">// update successful</span>
} <span class="hljs-keyword">else</span> {
    <span class="hljs-comment">// update failed</span>
}
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-db-activerecord.html#update()-detail">update</a></strong> ( <span style="color: #0000BB">$runValidation&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span>, <span style="color: #0000BB">$attributeNames&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$runValidation</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether to perform validation (calling <a href="yii-base-model.html#validate()-detail">validate()</a>)
before saving the record. Defaults to <code>true</code>. If the validation fails, the record
will not be saved to the database and this method will return <code>false</code>.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$attributeNames</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>List of attributes that need to be saved. Defaults to null,
meaning all attributes that are loaded from DB will be saved.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a>|<a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>The number of rows affected, or false if validation fails
or <a href="yii-db-baseactiverecord.html#beforeSave()-detail">beforeSave()</a> stops the updating process.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-db-staleobjectexception.html">yii\db\StaleObjectException</a></td>
                  <td class="param-desc-col"><p>if <a href="yii-db-baseactiverecord.html#optimisticLock()-detail">optimistic locking</a> is enabled and the data
being updated is outdated.</p>
</td>
                </tr>
                            <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="http://www.php.net/class.exception">Exception</a></td>
                  <td class="param-desc-col"><p>in case update failed.</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="updateAll()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#updateAll()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L205" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L205" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        updateAll()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Updates the whole table using the provided attribute values and conditions.</strong></p>

        <p>For example, to change the status to be 1 for all customers whose status is 2:</p>
<pre><code class="hljs php language-php">Customer::updateAll([<span class="hljs-string">'status'</span> =&gt; <span class="hljs-number">1</span>], <span class="hljs-string">'status = 2'</span>);
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a></span> <strong><a href="yii-db-activerecord.html#updateAll()-detail">updateAll</a></strong> ( <span style="color: #0000BB">$attributes</span>, <span style="color: #0000BB">$condition&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span>, <span style="color: #0000BB">$params&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$attributes</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>Attribute values (name-value pairs) to be saved into the table</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a>|<a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The conditions that will be put in the WHERE part of the UPDATE SQL.
Please refer to <a href="yii-db-query.html#where()-detail">yii\db\Query::where()</a> on how to specify this parameter.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$params</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The parameters (name =&gt; value) to be bound to the query.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a></td>
                  <td class="param-desc-col"><p>The number of rows updated</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="updateAllCounters()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-activerecord.html#updateAllCounters()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/ActiveRecord.php#L229" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveRecord.php#L229" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        updateAllCounters()
        <span class="detail-header-tag small">
            public                        static            method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Updates the whole table using the provided counter changes and conditions.</strong></p>

        <p>For example, to increment all customers' age by 1,</p>
<pre><code class="hljs php language-php">Customer::updateAllCounters([<span class="hljs-string">'age'</span> =&gt; <span class="hljs-number">1</span>]);
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public static</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a></span> <strong><a href="yii-db-activerecord.html#updateAllCounters()-detail">updateAllCounters</a></strong> ( <span style="color: #0000BB">$counters</span>, <span style="color: #0000BB">$condition&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span>, <span style="color: #0000BB">$params&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$counters</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The counters to be updated (attribute name =&gt; increment value).
Use negative values if you want to decrement the counters.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$condition</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a>|<a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The conditions that will be put in the WHERE part of the UPDATE SQL.
Please refer to <a href="yii-db-query.html#where()-detail">yii\db\Query::where()</a> on how to specify this parameter.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$params</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The parameters (name =&gt; value) to be bound to the query.
Do not name the parameters as <code>:bp0</code>, <code>:bp1</code>, etc., because they are used internally by this method.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a></td>
                  <td class="param-desc-col"><p>The number of rows updated</p>
</td>
                </tr>
                                    </table>

<!--	-->
</div>
        </div>
</div>

<script type="text/javascript">
    /*<![CDATA[*/
    $("a.toggle").on('click', function () {
        var $this = $(this);
        if ($this.hasClass('properties-hidden')) {
            $this.text($this.text().replace(/Show/,'Hide'));
            $this.parents(".summary").find(".inherited").show();
            $this.removeClass('properties-hidden');
        } else {
            $this.text($this.text().replace(/Hide/,'Show'));
            $this.parents(".summary").find(".inherited").hide();
            $this.addClass('properties-hidden');
        }

        return false;
    });
    /*
     $(".sourceCode a.show").toggle(function () {
     $(this).text($(this).text().replace(/show/,'hide'));
     $(this).parents(".sourceCode").find("div.code").show();
     },function () {
     $(this).text($(this).text().replace(/hide/,'show'));
     $(this).parents(".sourceCode").find("div.code").hide();
     });
     $("a.sourceLink").click(function () {
     $(this).attr('target','_blank');
     });
     */
    /*]]>*/
</script>


</div>

<footer class="footer">
        <p class="pull-right"><small>Page generated on Sat, 09 Jul 2016 12:15:50 +0000</small></p>
    Powered by <a href="http://www.yiiframework.com/" rel="external">Yii Framework</a></footer>

<script type="text/javascript">jQuery(document).ready(function () {
    var shiftWindow = function () { scrollBy(0, -50) };
    if (location.hash) setTimeout(shiftWindow, 1);
    window.addEventListener("hashchange", shiftWindow);
var element = document.createElement("script");
element.src = "./jssearch.index.js";
document.body.appendChild(element);

var searchBox = $('#searchbox');

// search when typing in search field
searchBox.on("keyup", function(event) {
    var query = $(this).val();

    if (query == '' || event.which == 27) {
        $('#search-resultbox').hide();
        return;
    } else if (event.which == 13) {
        var selectedLink = $('#search-resultbox a.selected');
        if (selectedLink.length != 0) {
            document.location = selectedLink.attr('href');
            return;
        }
    } else if (event.which == 38 || event.which == 40) {
        $('#search-resultbox').show();

        var selected = $('#search-resultbox a.selected');
        if (selected.length == 0) {
            $('#search-results').find('a').first().addClass('selected');
        } else {
            var next;
            if (event.which == 40) {
                next = selected.parent().next().find('a').first();
            } else {
                next = selected.parent().prev().find('a').first();
            }
            if (next.length != 0) {
                var resultbox = $('#search-results');
                var position = next.position();

//              TODO scrolling is buggy and jumps around
//                resultbox.scrollTop(Math.floor(position.top));
//                console.log(position.top);

                selected.removeClass('selected');
                next.addClass('selected');
            }
        }

        return;
    }
    $('#search-resultbox').show();
    $('#search-results').html('<li><span class="no-results">No results</span></li>');

    var result = jssearch.search(query);

    if (result.length > 0) {
        var i = 0;
        var resHtml = '';

        for (var key in result) {
            if (i++ > 20) {
                break;
            }
            resHtml = resHtml +
            '<li><a href="' + result[key].file.u.substr(3) +'"><span class="title">' + result[key].file.t + '</span>' +
            '<span class="description">' + result[key].file.d + '</span></a></li>';
        }
        $('#search-results').html(resHtml);
    }
});

// hide the search results on ESC
$(document).on("keyup", function(event) { if (event.which == 27) { $('#search-resultbox').hide(); } });
// hide search results on click to document
$(document).bind('click', function (e) { $('#search-resultbox').hide(); });
// except the following:
searchBox.bind('click', function(e) { e.stopPropagation(); });
$('#search-resultbox').bind('click', function(e) { e.stopPropagation(); });

});</script></body>
</html>
